- This topic is empty.
February 20, 2010 at 10:58 pm #28085
I have a problem with my PHP-Upload form, that (somehow) doesn’t work.
//get the size of the image in bytes
//$_FILES[‘image’][‘tmp_name’] is the temporary filename of the file
//in which the uploaded file was stored on the server
//compare the size with the maxim size we defined and print error if bigger
if ($size > MAX_SIZE*1024)
You have exceeded the size limit!
//we will give an unique name, for example the time in unix time format
//the new name will be containing the full path where will be stored (images folder)
//we verify if the image has been uploaded, and print error instead
$copied = copy($_FILES[‘image’][‘tmp_name’], $newname);
//If no errors registred, print the success message
if(isset($_POST[‘Submit’]) && !$errors)
File Uploaded Successfully! Try again!
Thats my entire code for uploading images on my server. But, the problem:
I’m getting the following error message: Warning: copy() [function.copy]: Unable to access in /var/www/web1/html/uploader/upload.php on line 58
I also don’t get… I’ve created the /images folder on my webspace, but it still doesn’t upload.
Hope someone could help me, I’m not perfect in PHP. > My website: http://knuddels-hosting.de/uploader/upload.phpFebruary 21, 2010 at 4:17 pm #71334February 23, 2010 at 8:19 pm #71487
Ok, now I’ve changed my entire code, I actually got it from http://www.zymic.com/tutorials/php/creating-a-file-upload-form-with-php/comments/, and here it is:
die(‘The file you attempted to upload is too large.’);
// Check if we can upload to the specified path, if not DIE and inform the user.
die(‘You cannot upload to the specified directory, please CHMOD it to 777.’);
// Upload the file to your specified path.
if(move_uploaded_file($_FILES[‘userfile’][‘tmp_name’],$upload_path . $filename))
echo ‘Your file upload was successful, view the file here‘; // It worked.
echo ‘There was an error during the file upload. Please try again.’; // It failed :(.
My example website: http://www.knuddels-hosting.de/php/testsite.php
Following error occurs: "There was an error during the file upload. Please try again."
- The forum ‘Back End’ is closed to new topics and replies.