Jump to content

[SOLVED] Upload Trouble


refiking

Recommended Posts

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
Share on other sites

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']:o['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';
   }

;D

PHP Can be a  :-X like that at times

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.