View Full Version : File upload issue
05-10-2008, 02:11 AM
I am trying to upload files to my server via PHP but can only do it on certain files.
if I try articles.doc it uploads fine but if I do Azul Azul - La Bomba.mp3 it won't upload.
Here is my code:
$resimadi = $_FILES['userfile']['name'];
$uploadfile =$uploaddir.'/'. $resimadi;
What could be the issue?
05-10-2008, 02:29 PM
there could be a number of details:
1.) Check the phpinfo(); for details on:
If you are having problems because of your php settings, then use .htaccess or your php.ini file.
2.) Rename the file before using move_uploaded_file();
05-10-2008, 05:16 PM
Do you realise how insecure that is? Hope thats not the whole script.
05-10-2008, 06:06 PM
Yeah I realize it's insecure. I stripped it down to find the error. I will try renaming it and see if that works.
05-10-2008, 06:20 PM
It is highly likely that an upload error is occurring (having something to do with the size of the file.) ALL code must test for any available error before attempting to use data. Read the discussion about the ['error'] element and the possible error values at this link - http://us2.php.net/manual/en/features.file-upload.php
I believe that link also mentions if you exceed the post_max_size setting that the $_FILES array will be null/not set (the $_POST array will be null/not set as well) and this condition needs to be tested for.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.