refiking Posted November 14, 2008 Share Posted November 14, 2008 What is wrong with this? I can't find anything wrong. Is it the code? I CHMOD the file form.php and the folder upload to 755 just to make sure. Here is the code: if ( move_uploaded_file ($_FILES['uploaded'] ['tmp_name'], 'upload/' . $_FILES['name'])){ Echo 'Successful'; } else{ Echo 'Not Successful'; } Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/ Share on other sites More sharing options...
vbnullchar Posted November 14, 2008 Share Posted November 14, 2008 i think its.. if ( move_uploaded_file ($_FILES['uploaded'] ['tmp_name'], 'upload/' . $_FILES['uploaded']['name'])){ Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690015 Share on other sites More sharing options...
refiking Posted November 14, 2008 Author Share Posted November 14, 2008 Returned Not Successful Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690016 Share on other sites More sharing options...
vbnullchar Posted November 14, 2008 Share Posted November 14, 2008 can you post the code.. or try chmod 777 Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690024 Share on other sites More sharing options...
DarkerAngel Posted November 14, 2008 Share Posted November 14, 2008 if ( move_uploaded_file ($_FILES['uploaded'] ['tmp_name'], 'upload/' . $_FILES['name'])){ Echo 'Successful'; } else{ Echo 'Not Successful'; } You know its probably such a tiny thing but if you look here: $_FILES['uploaded']['tmp_name'], you will notice a space.... try: if ( move_uploaded_file ($_FILES['uploaded']['tmp_name'], 'upload/' . $_FILES['name'])){ Echo 'Successful'; } else{ Echo 'Not Successful'; } PHP Can be a :-X like that at times Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690043 Share on other sites More sharing options...
refiking Posted November 14, 2008 Author Share Posted November 14, 2008 Still returned Not Successful Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690296 Share on other sites More sharing options...
refiking Posted November 14, 2008 Author Share Posted November 14, 2008 can you post the code.. or try chmod 777 IF ($change == "yes"){ IF ($addy == ""){ $error = 5; } IF ($city == ""){ $error = 6; } IF ($state == ""){ $error = 7; } IF ($email == ""){ $error = 9; } IF ($zip == ""){ $error = 8; } IF ($phone == ""){ $error = 10; } IF ($oha == ""){ $error = 11; } IF ($ohcsz == ""){ $error = 12; } IF ($oht == ""){ $error = 13; } IF ($cname == ""){ $error = 1; } IF ($lname == ""){ $error = 3; } IF ($fname == ""){ $error = 2; } IF ($error != ""){ header("Location: orderform.php?id=" . $error); exit; } if ( move_uploaded_file ($_FILES['uploaded']['tmp_name'], 'upload/' . $_FILES['name'])){ Echo 'Successful'; } else{ Echo 'Not Successful'; } } Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690297 Share on other sites More sharing options...
PFMaBiSmAd Posted November 14, 2008 Share Posted November 14, 2008 Add the following immediately after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "FILES:"; print_r($_FILES); echo "</pre>"; Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690299 Share on other sites More sharing options...
refiking Posted November 14, 2008 Author Share Posted November 14, 2008 Add the following immediately after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "FILES:"; print_r($_FILES); echo "</pre>"; Here's what it returned: FILES:Array ( ) Notice: Undefined variable: error in /hermes/web09/b2460/as.tcc08/public_html/orderform.php on line 45 Notice: Undefined index: uploaded in /hermes/web09/b2460/as.tcc08/public_html/orderform.php on line 50 Notice: Undefined index: name in /hermes/web09/b2460/as.tcc08/public_html/orderform.php on line 50 Not Successful Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690303 Share on other sites More sharing options...
PFMaBiSmAd Posted November 14, 2008 Share Posted November 14, 2008 An empty $_FILES array either means you form is invalid, uploads are not enabled on your server, or the size of the data from the form exceeds the post_max_size setting. Post your form to get help with the first possibility. Use a phpinfo() statement to check the settings for the second and third possibilities. Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690311 Share on other sites More sharing options...
refiking Posted November 14, 2008 Author Share Posted November 14, 2008 Here's The Form: <form action="orderform.php" method="post"><input type="hidden" name="change" value="yes"><table width="100%"> <tr><td width="20%" align="left">First Name:</td><td width="25%" align="left"><input type="text" name="fname"></td></tr> <tr><td width="20%" align="left">Last Name:</td><td width="25%" align="left"><input type="text" name="lname"></td></tr> <tr><td width="20%" align="left">Company Name:</td><td width="25%" align="left"><input type="text" name="cname"></td></tr> <tr><td width="20%" align="left">Email Address:</td><td width="25%" align="left"><input type="text" name="email"></td></tr> <tr><td width="20%" align="left">Address:</td><td width="25%" align="left"><input type="text" name="addy"></td></tr> <tr><td width="20%" align="left">City:</td><td width="25%" align="left"><input type="text" name="city"></td></tr> <tr><td width="20%" align="left">State:</td><td width="25%" align="left"><input type="text" name="state"></td></tr> <tr><td width="20%" align="left">Zip Code:</td><td width="25%" align="left"><input type="text" name="zip"></td></tr> <tr><td width="20%" align="left">Telephone:</td><td width="25%" align="left"><input type="text" name="phone"></td></tr> <tr><td width="20%" align="left">Fax:</td><td valign="top" align="left"><input type="text" name="fax"></td></tr> <tr><td width="20%" align="left">Open House Address:</td><td valign="top" align="left"><input type="text" name="oha"></td></tr> <tr><td width="20%" align="left">Open House City/State/Zip:</td><td valign="top" align="left"><input type="text" name="ohcsz"></td></tr> <tr><td width="20%" align="left">Open House Time:</td><td valign="top" align="left"><input type="text" name="oht"></td></tr> <tr><td valign="top">Special Instructions: </td><td><textarea name="si" rows="5" cols="25"></textarea></td></tr> </table> <hr width="80% align="center"> <table> <tr><td width="20%" align="left">Color Copy:</td><td valign="top" align="left">Yes <input type="radio" name="cc" value="Yes"> No<input type="radio" name="cc" value="No"></td></tr> <tr><td width="20%" valign="top" align="left">Copy Instructions:</td><td valign="top" align="left"><textarea name="ci" rows="5" cols="25"></textarea></td></tr> <tr><td width="20%" align="left">Upload File:</td><td valign="top" align="left"><input name="uploaded" type="file"></td></tr> <tr><td> </td><td><input type="submit" value="Submit Now"></td></tr></table></form> Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690321 Share on other sites More sharing options...
PFMaBiSmAd Posted November 14, 2008 Share Posted November 14, 2008 An upload form need a enctype="multipart/form-data" parameter. As with any programming, start by reading the upload section in the php manual to find out the requirements for what you are doing - http://us2.php.net/features.file-upload Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690329 Share on other sites More sharing options...
refiking Posted November 14, 2008 Author Share Posted November 14, 2008 ahhhh yes! I knew I was forgetting something. Thanks for referring me back to the documentation. I appreciate your assistance! Link to comment https://forums.phpfreaks.com/topic/132675-solved-upload-trouble/#findComment-690340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.