Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your are trying to move a file to a path that has been <code>mysql_real_escape_string()</code>ed, which means it could potentially contain backslashes, which obviously will not work (at least, not in the way you expect it to).</p> <p>Try this:</p> <pre><code>//This is my path for storing images. (I am using wamp 2.0) $basePath = "../artistImages/"; $image = $_FILES['myimage']; $storagePath = $basePath.$image['name']; if (!is_dir($basePath)) { echo "Base path '$basePath' does not exist"; } else if (file_exists($storagePath)) { echo "File '$storagePath' already exists"; } else if (!move_uploaded_file($image['tmp_name'], $storagePath)) { echo "Could not move file to '$storagePath'. Check read/write persmissions on the directory"; } else { $insertQuery = "INSERT INTO `$tbl_name` (`ArtistImage`) VALUES ('".mysql_real_escape_string($image['name'])."')"; if (!mysql_query($insertQuery)) die("DB insert failed: ".mysql_error()); } </code></pre> <p>Note that the above code has many error messages in that you would want remove, or at least water down before you put the code into any kind of environment where it would actually be used, but it should help you to debug the code while developing.</p> <p><strong>EDIT</strong></p> <p>If you actually do need to change the permissions on a folder, the method for doing it varies greatly between versions of Windows (actually it's pretty much identical for all 2K+ versions, but in some you may have to change some settings to get the correct dialogs to appear) and it would be a question for <a href="http://www.SuperUser.com/" rel="nofollow">http://www.SuperUser.com/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload