This is a discussion on Help uploading a file please within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hey guys, I am trying to get this script working to upload a file and it keeps saying there's ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hey guys, I am trying to get this script working to upload a file and it
keeps saying there's an error in copying the file. I've included as much as I can to ask for help here. I've CHMODDED both the upload and files folders to 777 as well. Here's the culprits and a link to my phpinfo file. http://www.romsbytom.com/upload1.html http://www.romsbytom.com/upload2.html http://www.romsbytom.com/php/phpinfo.php Finally here is the contents of the upload1.php and upload2.php files: upload1.php contents <html> <head> <title>Upload File</title> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" alink="#0000ff" topmargin="0" marginheight="0"> <p> </p> <div align=center width=98%><h3> Upload File</h2><FORM ACTION="upload2.php" METHOD="POST" ENCTYPE="multipart/form-data"> <CENTER> <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> <tr><td><b> Name :</b> </td> <td ><input type="text" name="name" size="40" maxlength="80" ></td></tr> <tr > <td width=113><b> email : </b> </td> <td width=289><p><input type=text name="email" size=30> </td> </tr> <tr > <td width=113> <p align=right><b>file to be sent: </b> </td> <td width=289> <p><input type=file name="superdat" size=30></p> </td> </tr> <tr> <td colspan=2 align=center><b>Message:</b> </td> </tr> <tr> <td colspan=2 align=center> <textarea name="message" rows="3" cols="40"></textarea> </td> </tr> </TABLE> </CENTER> <DIV ALIGN=CENTER> <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" VALUE="Upload File"></P> </DIV> </FORM> </body> </html> upload2.php contents <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>upload</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" alink="#0000ff" topmargin="0" marginheight="0"> <? $mailheaders = "File upload"; if ($email == "") { } else { die("No email address specified."); } if ($superdat_name == "") { copy("$superdat", "/home/vidkid72/public_html/upload/files/$superdat_name") or die("Couldn't copy file."); } else { die("No input file specified."); } mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a $superdat_size byte file with a MIME type of $superdat_type \n nome :$name\n message :$message"); ?> <html> <head> <body bgcolor=white text=black link=blue> <!--Header/Logo--> <p> </p> <p> </p> <p align=center><h3>Your upload has been successfully sent and I will be in contact with you shortly!</h3></p> <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? echo "$superdat_size"; ?> byte file with a mime type of <? echo "$superdat_type"; ?>.See your file <a href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; ?>">here</a></p> </body> </html> Thanks. -Tom -- http://www.romsbytom.com EPROM Programming Service |
|
|||
|
Oops, the correct links are:
http://www.romsbytom.com/upload1.php http://www.romsbytom.com/upload2.php http://www.romsbytom.com/php/phpinfo.php "Tom Lavier (unmunge email before replying directly)" <tlavierSTOP@SPAMsympatico.ca> wrote in message news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > Hey guys, I am trying to get this script working to upload a file and it > keeps saying there's an error in copying the file. I've included as much as > I can to ask for help here. I've CHMODDED both the upload and files folders > to 777 as well. > > Here's the culprits and a link to my phpinfo file. > http://www.romsbytom.com/upload1.html > http://www.romsbytom.com/upload2.html > http://www.romsbytom.com/php/phpinfo.php > > Finally here is the contents of the upload1.php and upload2.php files: > > upload1.php contents > > <html> > <head> > <title>Upload File</title> > </head> > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > alink="#0000ff" > topmargin="0" marginheight="0"> > > <p> </p> > <div align=center width=98%><h3> Upload File</h2><FORM ACTION="upload2.php" > METHOD="POST" ENCTYPE="multipart/form-data"> > <CENTER> > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > <tr><td><b> Name :</b> </td> > <td ><input type="text" name="name" size="40" maxlength="80" ></td></tr> > <tr > > <td width=113><b> email : </b> </td> > <td width=289><p><input type=text name="email" size=30> > </td> > </tr> > > <tr > > <td width=113> > <p align=right><b>file to be sent: </b> > </td> > <td width=289> > <p><input type=file name="superdat" size=30></p> > </td> > </tr> > <tr> > <td colspan=2 align=center><b>Message:</b> > </td> > </tr> > > <tr> > <td colspan=2 align=center> > <textarea name="message" rows="3" cols="40"></textarea> </td> > </tr> > > > </TABLE> > </CENTER> > <DIV ALIGN=CENTER> > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > VALUE="Upload File"></P> > </DIV> > </FORM> > > > </body> > </html> > > > > upload2.php contents > > <!doctype html public "-//w3c//dtd html 3.2//en"> > <html> > <head> > <title>upload</title> > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > </head> > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > alink="#0000ff" > topmargin="0" marginheight="0"> > > <? > $mailheaders = "File upload"; > > if ($email == "") { > } else { > die("No email address specified."); > > } > > if ($superdat_name == "") { > copy("$superdat", "/home/vidkid72/public_html/upload/files/$superdat_name") > or > die("Couldn't copy file."); > > } else { > die("No input file specified."); > } > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a > $superdat_size byte file with a MIME type of $superdat_type \n nome :$name\n > message :$message"); > > ?> > > <html> > <head> > > <body bgcolor=white text=black link=blue> > > <!--Header/Logo--> > <p> </p> > <p> </p> > > <p align=center><h3>Your upload has been successfully sent and I will be in > contact with you shortly!</h3></p> > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? echo > "$superdat_size"; ?> > byte file with a mime type of <? echo "$superdat_type"; ?>.See your file <a > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > ?>">here</a></p> > </body> > </html> > > > Thanks. > > -Tom > > -- > http://www.romsbytom.com > EPROM Programming Service > > > |
|
|||
|
"Tom Lavier (unmunge email before replying directly)" <tlavierSTOP@SPAMsympatico.ca> wrote in message news:42Ozb.12723$yd.1800584@news20.bellglobal.com. .. > Oops, the correct links are: > http://www.romsbytom.com/upload1.php > http://www.romsbytom.com/upload2.php > http://www.romsbytom.com/php/phpinfo.php > > > "Tom Lavier (unmunge email before replying directly)" > <tlavierSTOP@SPAMsympatico.ca> wrote in message > news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > > Hey guys, I am trying to get this script working to upload a file and it > > keeps saying there's an error in copying the file. I've included as much > as > > I can to ask for help here. I've CHMODDED both the upload and files > folders > > to 777 as well. > > > > Here's the culprits and a link to my phpinfo file. > > http://www.romsbytom.com/upload1.html > > http://www.romsbytom.com/upload2.html > > http://www.romsbytom.com/php/phpinfo.php > > > > Finally here is the contents of the upload1.php and upload2.php files: > > > > upload1.php contents > > > > <html> > > <head> > > <title>Upload File</title> > > </head> > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > alink="#0000ff" > > topmargin="0" marginheight="0"> > > > > <p> </p> > > <div align=center width=98%><h3> Upload File</h2><FORM > ACTION="upload2.php" > > METHOD="POST" ENCTYPE="multipart/form-data"> > > <CENTER> > > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > > <tr><td><b> Name :</b> </td> > > <td ><input type="text" name="name" size="40" maxlength="80" ></td></tr> > > <tr > > > <td width=113><b> email : </b> </td> > > <td width=289><p><input type=text name="email" > size=30> > > </td> > > </tr> > > > > <tr > > > <td width=113> > > <p align=right><b>file to be sent: </b> > > </td> > > <td width=289> > > <p><input type=file name="superdat" size=30></p> > > </td> > > </tr> > > <tr> > > <td colspan=2 align=center><b>Message:</b> > > </td> > > </tr> > > > > <tr> > > <td colspan=2 align=center> > > <textarea name="message" rows="3" cols="40"></textarea> </td> > > </tr> > > > > > > </TABLE> > > </CENTER> > > <DIV ALIGN=CENTER> > > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > > VALUE="Upload File"></P> > > </DIV> > > </FORM> > > > > > > </body> > > </html> > > > > > > > > upload2.php contents > > > > <!doctype html public "-//w3c//dtd html 3.2//en"> > > <html> > > <head> > > <title>upload</title> > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > > </head> > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > alink="#0000ff" > > topmargin="0" marginheight="0"> > > > > <? > > $mailheaders = "File upload"; > > > > if ($email == "") { > > } else { > > die("No email address specified."); > > > > } > > > > if ($superdat_name == "") { > > copy("$superdat", > "/home/vidkid72/public_html/upload/files/$superdat_name") > > or > > die("Couldn't copy file."); > > > > } else { > > die("No input file specified."); > > } > > > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a > > $superdat_size byte file with a MIME type of $superdat_type \n nome > :$name\n > > message :$message"); > > > > ?> > > > > <html> > > <head> > > > > <body bgcolor=white text=black link=blue> > > > > <!--Header/Logo--> > > <p> </p> > > <p> </p> > > > > <p align=center><h3>Your upload has been successfully sent and I will be > in > > contact with you shortly!</h3></p> > > > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? echo > > "$superdat_size"; ?> > > byte file with a mime type of <? echo "$superdat_type"; ?>.See your file > <a > > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > > ?>">here</a></p> > > </body> > > </html> > > > > > > Thanks. > > > > -Tom > > > > -- > > http://www.romsbytom.com > > EPROM Programming Service > > > > I didnt try this code, but... Your file actually gets uploaded to PHP's tmp directory. It can be referenced by $userfile = $HTTP_POST_FILES['superdat']['tmp_name']; and then copied or moved $newName = $HTTP_POST_FILES['superdat']['name']; move_uploaded_file($userfile, "/home/vidkid72/public_html/upload/files/$newName") |
|
|||
|
"Tom Lavier (unmunge email before replying directly)" <tlavierSTOP@SPAMsympatico.ca> wrote in message news:42Ozb.12723$yd.1800584@news20.bellglobal.com. .. > Oops, the correct links are: > http://www.romsbytom.com/upload1.php > http://www.romsbytom.com/upload2.php > http://www.romsbytom.com/php/phpinfo.php > > > "Tom Lavier (unmunge email before replying directly)" > <tlavierSTOP@SPAMsympatico.ca> wrote in message > news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > > Hey guys, I am trying to get this script working to upload a file and it > > keeps saying there's an error in copying the file. I've included as much > as > > I can to ask for help here. I've CHMODDED both the upload and files > folders > > to 777 as well. > > > > Here's the culprits and a link to my phpinfo file. > > http://www.romsbytom.com/upload1.html > > http://www.romsbytom.com/upload2.html > > http://www.romsbytom.com/php/phpinfo.php > > > > Finally here is the contents of the upload1.php and upload2.php files: > > > > upload1.php contents > > > > <html> > > <head> > > <title>Upload File</title> > > </head> > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > alink="#0000ff" > > topmargin="0" marginheight="0"> > > > > <p> </p> > > <div align=center width=98%><h3> Upload File</h2><FORM > ACTION="upload2.php" > > METHOD="POST" ENCTYPE="multipart/form-data"> > > <CENTER> > > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > > <tr><td><b> Name :</b> </td> > > <td ><input type="text" name="name" size="40" maxlength="80" ></td></tr> > > <tr > > > <td width=113><b> email : </b> </td> > > <td width=289><p><input type=text name="email" > size=30> > > </td> > > </tr> > > > > <tr > > > <td width=113> > > <p align=right><b>file to be sent: </b> > > </td> > > <td width=289> > > <p><input type=file name="superdat" size=30></p> > > </td> > > </tr> > > <tr> > > <td colspan=2 align=center><b>Message:</b> > > </td> > > </tr> > > > > <tr> > > <td colspan=2 align=center> > > <textarea name="message" rows="3" cols="40"></textarea> </td> > > </tr> > > > > > > </TABLE> > > </CENTER> > > <DIV ALIGN=CENTER> > > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > > VALUE="Upload File"></P> > > </DIV> > > </FORM> > > > > > > </body> > > </html> > > > > > > > > upload2.php contents > > > > <!doctype html public "-//w3c//dtd html 3.2//en"> > > <html> > > <head> > > <title>upload</title> > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > > </head> > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > alink="#0000ff" > > topmargin="0" marginheight="0"> > > > > <? > > $mailheaders = "File upload"; > > > > if ($email == "") { > > } else { > > die("No email address specified."); > > > > } > > > > if ($superdat_name == "") { > > copy("$superdat", > "/home/vidkid72/public_html/upload/files/$superdat_name") > > or > > die("Couldn't copy file."); > > > > } else { > > die("No input file specified."); > > } > > > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a > > $superdat_size byte file with a MIME type of $superdat_type \n nome > :$name\n > > message :$message"); > > > > ?> > > > > <html> > > <head> > > > > <body bgcolor=white text=black link=blue> > > > > <!--Header/Logo--> > > <p> </p> > > <p> </p> > > > > <p align=center><h3>Your upload has been successfully sent and I will be > in > > contact with you shortly!</h3></p> > > > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? echo > > "$superdat_size"; ?> > > byte file with a mime type of <? echo "$superdat_type"; ?>.See your file > <a > > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > > ?>">here</a></p> > > </body> > > </html> > > > > > > Thanks. > > > > -Tom > > > > -- > > http://www.romsbytom.com > > EPROM Programming Service > > > > > > > > My last post wasnt complete. You must move the file from the tmp location to your home directory <? $userfile = $HTTP_POST_FILES[superdat]['tmp_name']; $userfile_name = $HTTP_POST_FILES[superdat]['name']; $upfile = '/home/vidkid72/public_html/upload/files/ ' . $superdat_name; move_uploaded_file($superdat, $upfile) ?> |
|
|||
|
Thanks for the help but I'm not sure where to place that code.
<xyzzy> wrote in message news:6tadnRW5_ojTXlKiRVn-iw@comcast.com... > > "Tom Lavier (unmunge email before replying directly)" > <tlavierSTOP@SPAMsympatico.ca> wrote in message > news:42Ozb.12723$yd.1800584@news20.bellglobal.com. .. > > Oops, the correct links are: > > http://www.romsbytom.com/upload1.php > > http://www.romsbytom.com/upload2.php > > http://www.romsbytom.com/php/phpinfo.php > > > > > > "Tom Lavier (unmunge email before replying directly)" > > <tlavierSTOP@SPAMsympatico.ca> wrote in message > > news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > > > Hey guys, I am trying to get this script working to upload a file and it > > > keeps saying there's an error in copying the file. I've included as > much > > as > > > I can to ask for help here. I've CHMODDED both the upload and files > > folders > > > to 777 as well. > > > > > > Here's the culprits and a link to my phpinfo file. > > > http://www.romsbytom.com/upload1.html > > > http://www.romsbytom.com/upload2.html > > > http://www.romsbytom.com/php/phpinfo.php > > > > > > Finally here is the contents of the upload1.php and upload2.php files: > > > > > > upload1.php contents > > > > > > <html> > > > <head> > > > <title>Upload File</title> > > > </head> > > > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > > alink="#0000ff" > > > topmargin="0" marginheight="0"> > > > > > > <p> </p> > > > <div align=center width=98%><h3> Upload File</h2><FORM > > ACTION="upload2.php" > > > METHOD="POST" ENCTYPE="multipart/form-data"> > > > <CENTER> > > > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > > > <tr><td><b> Name :</b> </td> > > > <td ><input type="text" name="name" size="40" maxlength="80" > ></td></tr> > > > <tr > > > > <td width=113><b> email : </b> </td> > > > <td width=289><p><input type=text name="email" > > size=30> > > > </td> > > > </tr> > > > > > > <tr > > > > <td width=113> > > > <p align=right><b>file to be sent: </b> > > > </td> > > > <td width=289> > > > <p><input type=file name="superdat" size=30></p> > > > </td> > > > </tr> > > > <tr> > > > <td colspan=2 align=center><b>Message:</b> > > > </td> > > > </tr> > > > > > > <tr> > > > <td colspan=2 align=center> > > > <textarea name="message" rows="3" cols="40"></textarea> </td> > > > </tr> > > > > > > > > > </TABLE> > > > </CENTER> > > > <DIV ALIGN=CENTER> > > > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > > > VALUE="Upload File"></P> > > > </DIV> > > > </FORM> > > > > > > > > > </body> > > > </html> > > > > > > > > > > > > upload2.php contents > > > > > > <!doctype html public "-//w3c//dtd html 3.2//en"> > > > <html> > > > <head> > > > <title>upload</title> > > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > > > </head> > > > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > > alink="#0000ff" > > > topmargin="0" marginheight="0"> > > > > > > <? > > > $mailheaders = "File upload"; > > > > > > if ($email == "") { > > > } else { > > > die("No email address specified."); > > > > > > } > > > > > > if ($superdat_name == "") { > > > copy("$superdat", > > "/home/vidkid72/public_html/upload/files/$superdat_name") > > > or > > > die("Couldn't copy file."); > > > > > > } else { > > > die("No input file specified."); > > > } > > > > > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a > > > $superdat_size byte file with a MIME type of $superdat_type \n nome > > :$name\n > > > message :$message"); > > > > > > ?> > > > > > > <html> > > > <head> > > > > > > <body bgcolor=white text=black link=blue> > > > > > > <!--Header/Logo--> > > > <p> </p> > > > <p> </p> > > > > > > <p align=center><h3>Your upload has been successfully sent and I will be > > in > > > contact with you shortly!</h3></p> > > > > > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? > echo > > > "$superdat_size"; ?> > > > byte file with a mime type of <? echo "$superdat_type"; ?>.See your file > > <a > > > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > > > ?>">here</a></p> > > > </body> > > > </html> > > > > > > > > > Thanks. > > > > > > -Tom > > > > > > -- > > > http://www.romsbytom.com > > > EPROM Programming Service > > > > > > > > > > > > > > > My last post wasnt complete. > You must move the file from the tmp location to your home directory > > > <? > $userfile = $HTTP_POST_FILES[superdat]['tmp_name']; > $userfile_name = $HTTP_POST_FILES[superdat]['name']; > $upfile = '/home/vidkid72/public_html/upload/files/ ' . $superdat_name; > move_uploaded_file($superdat, $upfile) > ?> > > > > |
|
|||
|
"Tom Lavier (unmunge email before replying directly)" <tlavierSTOP@SPAMsympatico.ca> wrote in message news:4wUzb.13750$yd.1978168@news20.bellglobal.com. .. > Thanks for the help but I'm not sure where to place that code. > > <xyzzy> wrote in message news:6tadnRW5_ojTXlKiRVn-iw@comcast.com... > > > > "Tom Lavier (unmunge email before replying directly)" > > <tlavierSTOP@SPAMsympatico.ca> wrote in message > > news:42Ozb.12723$yd.1800584@news20.bellglobal.com. .. > > > Oops, the correct links are: > > > http://www.romsbytom.com/upload1.php > > > http://www.romsbytom.com/upload2.php > > > http://www.romsbytom.com/php/phpinfo.php > > > > > > > > > "Tom Lavier (unmunge email before replying directly)" > > > <tlavierSTOP@SPAMsympatico.ca> wrote in message > > > news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > > > > Hey guys, I am trying to get this script working to upload a file and > it > > > > keeps saying there's an error in copying the file. I've included as > > much > > > as > > > > I can to ask for help here. I've CHMODDED both the upload and files > > > folders > > > > to 777 as well. > > > > > > > > Here's the culprits and a link to my phpinfo file. > > > > http://www.romsbytom.com/upload1.html > > > > http://www.romsbytom.com/upload2.html > > > > http://www.romsbytom.com/php/phpinfo.php > > > > > > > > Finally here is the contents of the upload1.php and upload2.php files: > > > > > > > > upload1.php contents > > > > > > > > <html> > > > > <head> > > > > <title>Upload File</title> > > > > </head> > > > > > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > > > alink="#0000ff" > > > > topmargin="0" marginheight="0"> > > > > > > > > <p> </p> > > > > <div align=center width=98%><h3> Upload File</h2><FORM > > > ACTION="upload2.php" > > > > METHOD="POST" ENCTYPE="multipart/form-data"> > > > > <CENTER> > > > > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > > > > <tr><td><b> Name :</b> </td> > > > > <td ><input type="text" name="name" size="40" maxlength="80" > > ></td></tr> > > > > <tr > > > > > <td width=113><b> email : </b> </td> > > > > <td width=289><p><input type=text name="email" > > > size=30> > > > > </td> > > > > </tr> > > > > > > > > <tr > > > > > <td width=113> > > > > <p align=right><b>file to be sent: </b> > > > > </td> > > > > <td width=289> > > > > <p><input type=file name="superdat" > size=30></p> > > > > </td> > > > > </tr> > > > > <tr> > > > > <td colspan=2 align=center><b>Message:</b> > > > > </td> > > > > </tr> > > > > > > > > <tr> > > > > <td colspan=2 align=center> > > > > <textarea name="message" rows="3" cols="40"></textarea> </td> > > > > </tr> > > > > > > > > > > > > </TABLE> > > > > </CENTER> > > > > <DIV ALIGN=CENTER> > > > > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > > > > VALUE="Upload File"></P> > > > > </DIV> > > > > </FORM> > > > > > > > > > > > > </body> > > > > </html> > > > > > > > > > > > > > > > > upload2.php contents > > > > > > > > <!doctype html public "-//w3c//dtd html 3.2//en"> > > > > <html> > > > > <head> > > > > <title>upload</title> > > > > <meta http-equiv="content-type" content="text/html; > charset=iso-8859-1"> > > > > </head> > > > > > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > > > alink="#0000ff" > > > > topmargin="0" marginheight="0"> > > > > > > > > <? > > > > $mailheaders = "File upload"; > > > > > > > > if ($email == "") { > > > > } else { > > > > die("No email address specified."); > > > > > > > > } > > > > > > > > if ($superdat_name == "") { > > > > copy("$superdat", > > > "/home/vidkid72/public_html/upload/files/$superdat_name") > > > > or > > > > die("Couldn't copy file."); > > > > > > > > } else { > > > > die("No input file specified."); > > > > } > > > > > > > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, > a > > > > $superdat_size byte file with a MIME type of $superdat_type \n nome > > > :$name\n > > > > message :$message"); > > > > > > > > ?> > > > > > > > > <html> > > > > <head> > > > > > > > > <body bgcolor=white text=black link=blue> > > > > > > > > <!--Header/Logo--> > > > > <p> </p> > > > > <p> </p> > > > > > > > > <p align=center><h3>Your upload has been successfully sent and I will > be > > > in > > > > contact with you shortly!</h3></p> > > > > > > > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? > > echo > > > > "$superdat_size"; ?> > > > > byte file with a mime type of <? echo "$superdat_type"; ?>.See your > file > > > <a > > > > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > > > > ?>">here</a></p> > > > > </body> > > > > </html> > > > > > > > > > > > > Thanks. > > > > > > > > -Tom > > > > > > > > -- > > > > http://www.romsbytom.com > > > > EPROM Programming Service > > > > > > > > > > > > > > > > > > > > > > My last post wasnt complete. > > You must move the file from the tmp location to your home directory > > > > > > <? > > $userfile = $HTTP_POST_FILES[superdat]['tmp_name']; > > $userfile_name = $HTTP_POST_FILES[superdat]['name']; > > $upfile = '/home/vidkid72/public_html/upload/files/ ' . $superdat_name; > > move_uploaded_file($superdat, $upfile) > > ?> > > > > > > > > > Sorry. It processes the results of your form (file upload) So, at the top of upload2.php > |
|
|||
|
My code for processing the upload form is:-
$uploaddir = $CFG->imagedir . "/"; $uploadfile = $uploaddir. $_FILES['userfile']['name']; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { print "<p class=h2>File is valid, and was successfully uploaded.</p>"; print "<p class=h3>Here's some file info</p>"; print "<p class=h3>Type: "; print $_FILES['userfile']['type']; print "<p class=h3>Size: "; print $_FILES['userfile']['size']; print " bytes."; // now make a thumbnail Makethumb($_FILES['userfile']['name']); } else { print "<p class=h2>File upload error!!</p>"; print "<p class=h2>Here's some debugging info:</p>"; print "<p class=h3>Type: "; print $_FILES['userfile']['type']; print "<p class=h3>Size: "; print $_FILES['userfile']['size']; print " bytes."; print "<p class=h3>Error code: "; print $_FILES['userfile']['error']; } "Tom Lavier (unmunge email before replying directly)" <tlavierSTOP@SPAMsympatico.ca> wrote in message news:42Ozb.12723$yd.1800584@news20.bellglobal.com. .. > Oops, the correct links are: > http://www.romsbytom.com/upload1.php > http://www.romsbytom.com/upload2.php > http://www.romsbytom.com/php/phpinfo.php > > > "Tom Lavier (unmunge email before replying directly)" > <tlavierSTOP@SPAMsympatico.ca> wrote in message > news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > > Hey guys, I am trying to get this script working to upload a file and it > > keeps saying there's an error in copying the file. I've included as much > as > > I can to ask for help here. I've CHMODDED both the upload and files > folders > > to 777 as well. > > > > Here's the culprits and a link to my phpinfo file. > > http://www.romsbytom.com/upload1.html > > http://www.romsbytom.com/upload2.html > > http://www.romsbytom.com/php/phpinfo.php > > > > Finally here is the contents of the upload1.php and upload2.php files: > > > > upload1.php contents > > > > <html> > > <head> > > <title>Upload File</title> > > </head> > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > alink="#0000ff" > > topmargin="0" marginheight="0"> > > > > <p> </p> > > <div align=center width=98%><h3> Upload File</h2><FORM > ACTION="upload2.php" > > METHOD="POST" ENCTYPE="multipart/form-data"> > > <CENTER> > > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > > <tr><td><b> Name :</b> </td> > > <td ><input type="text" name="name" size="40" maxlength="80" ></td></tr> > > <tr > > > <td width=113><b> email : </b> </td> > > <td width=289><p><input type=text name="email" > size=30> > > </td> > > </tr> > > > > <tr > > > <td width=113> > > <p align=right><b>file to be sent: </b> > > </td> > > <td width=289> > > <p><input type=file name="superdat" size=30></p> > > </td> > > </tr> > > <tr> > > <td colspan=2 align=center><b>Message:</b> > > </td> > > </tr> > > > > <tr> > > <td colspan=2 align=center> > > <textarea name="message" rows="3" cols="40"></textarea> </td> > > </tr> > > > > > > </TABLE> > > </CENTER> > > <DIV ALIGN=CENTER> > > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > > VALUE="Upload File"></P> > > </DIV> > > </FORM> > > > > > > </body> > > </html> > > > > > > > > upload2.php contents > > > > <!doctype html public "-//w3c//dtd html 3.2//en"> > > <html> > > <head> > > <title>upload</title> > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > > </head> > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > alink="#0000ff" > > topmargin="0" marginheight="0"> > > > > <? > > $mailheaders = "File upload"; > > > > if ($email == "") { > > } else { > > die("No email address specified."); > > > > } > > > > if ($superdat_name == "") { > > copy("$superdat", > "/home/vidkid72/public_html/upload/files/$superdat_name") > > or > > die("Couldn't copy file."); > > > > } else { > > die("No input file specified."); > > } > > > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a > > $superdat_size byte file with a MIME type of $superdat_type \n nome > :$name\n > > message :$message"); > > > > ?> > > > > <html> > > <head> > > > > <body bgcolor=white text=black link=blue> > > > > <!--Header/Logo--> > > <p> </p> > > <p> </p> > > > > <p align=center><h3>Your upload has been successfully sent and I will be > in > > contact with you shortly!</h3></p> > > > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? echo > > "$superdat_size"; ?> > > byte file with a mime type of <? echo "$superdat_type"; ?>.See your file > <a > > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > > ?>">here</a></p> > > </body> > > </html> > > > > > > Thanks. > > > > -Tom > > > > -- > > http://www.romsbytom.com > > EPROM Programming Service > > > > > > > > |
|
|||
|
Sorry, did not mean to use the 'makethumbs' bit.
"Ian Pawson" <ian@ipawson.com> wrote in message news:3fd0bb63$0$9388$cc9e4d1f@news-text.dial.pipex.com... > My code for processing the upload form is:- > $uploaddir = $CFG->imagedir . "/"; > $uploadfile = $uploaddir. $_FILES['userfile']['name']; > > if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { > print "<p class=h2>File is valid, and was successfully uploaded.</p>"; > print "<p class=h3>Here's some file info</p>"; > print "<p class=h3>Type: "; > print $_FILES['userfile']['type']; > print "<p class=h3>Size: "; > print $_FILES['userfile']['size']; > print " bytes."; > > // now make a thumbnail > Makethumb($_FILES['userfile']['name']); > } else { > print "<p class=h2>File upload error!!</p>"; > print "<p class=h2>Here's some debugging info:</p>"; > print "<p class=h3>Type: "; > print $_FILES['userfile']['type']; > print "<p class=h3>Size: "; > print $_FILES['userfile']['size']; > print " bytes."; > print "<p class=h3>Error code: "; > print $_FILES['userfile']['error']; > } > > > > "Tom Lavier (unmunge email before replying directly)" > <tlavierSTOP@SPAMsympatico.ca> wrote in message > news:42Ozb.12723$yd.1800584@news20.bellglobal.com. .. > > Oops, the correct links are: > > http://www.romsbytom.com/upload1.php > > http://www.romsbytom.com/upload2.php > > http://www.romsbytom.com/php/phpinfo.php > > > > > > "Tom Lavier (unmunge email before replying directly)" > > <tlavierSTOP@SPAMsympatico.ca> wrote in message > > news:gcKzb.12529$zf2.1440859@news20.bellglobal.com ... > > > Hey guys, I am trying to get this script working to upload a file and it > > > keeps saying there's an error in copying the file. I've included as > much > > as > > > I can to ask for help here. I've CHMODDED both the upload and files > > folders > > > to 777 as well. > > > > > > Here's the culprits and a link to my phpinfo file. > > > http://www.romsbytom.com/upload1.html > > > http://www.romsbytom.com/upload2.html > > > http://www.romsbytom.com/php/phpinfo.php > > > > > > Finally here is the contents of the upload1.php and upload2.php files: > > > > > > upload1.php contents > > > > > > <html> > > > <head> > > > <title>Upload File</title> > > > </head> > > > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > > alink="#0000ff" > > > topmargin="0" marginheight="0"> > > > > > > <p> </p> > > > <div align=center width=98%><h3> Upload File</h2><FORM > > ACTION="upload2.php" > > > METHOD="POST" ENCTYPE="multipart/form-data"> > > > <CENTER> > > > <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news> > > > <tr><td><b> Name :</b> </td> > > > <td ><input type="text" name="name" size="40" maxlength="80" > ></td></tr> > > > <tr > > > > <td width=113><b> email : </b> </td> > > > <td width=289><p><input type=text name="email" > > size=30> > > > </td> > > > </tr> > > > > > > <tr > > > > <td width=113> > > > <p align=right><b>file to be sent: </b> > > > </td> > > > <td width=289> > > > <p><input type=file name="superdat" size=30></p> > > > </td> > > > </tr> > > > <tr> > > > <td colspan=2 align=center><b>Message:</b> > > > </td> > > > </tr> > > > > > > <tr> > > > <td colspan=2 align=center> > > > <textarea name="message" rows="3" cols="40"></textarea> </td> > > > </tr> > > > > > > > > > </TABLE> > > > </CENTER> > > > <DIV ALIGN=CENTER> > > > <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" > > > VALUE="Upload File"></P> > > > </DIV> > > > </FORM> > > > > > > > > > </body> > > > </html> > > > > > > > > > > > > upload2.php contents > > > > > > <!doctype html public "-//w3c//dtd html 3.2//en"> > > > <html> > > > <head> > > > <title>upload</title> > > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > > > </head> > > > > > > <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" > > > alink="#0000ff" > > > topmargin="0" marginheight="0"> > > > > > > <? > > > $mailheaders = "File upload"; > > > > > > if ($email == "") { > > > } else { > > > die("No email address specified."); > > > > > > } > > > > > > if ($superdat_name == "") { > > > copy("$superdat", > > "/home/vidkid72/public_html/upload/files/$superdat_name") > > > or > > > die("Couldn't copy file."); > > > > > > } else { > > > die("No input file specified."); > > > } > > > > > > mail("tom@romsbytom.com","$mailheaders", "$email sent $superdat_name, a > > > $superdat_size byte file with a MIME type of $superdat_type \n nome > > :$name\n > > > message :$message"); > > > > > > ?> > > > > > > <html> > > > <head> > > > > > > <body bgcolor=white text=black link=blue> > > > > > > <!--Header/Logo--> > > > <p> </p> > > > <p> </p> > > > > > > <p align=center><h3>Your upload has been successfully sent and I will be > > in > > > contact with you shortly!</h3></p> > > > > > > <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? > echo > > > "$superdat_size"; ?> > > > byte file with a mime type of <? echo "$superdat_type"; ?>.See your file > > <a > > > href="http://www.romsbytom.com\upload/files/<? echo "$superdat_name"; > > > ?>">here</a></p> > > > </body> > > > </html> > > > > > > > > > Thanks. > > > > > > -Tom > > > > > > -- > > > http://www.romsbytom.com > > > EPROM Programming Service > > > > > > > > > > > > > > > |
![]() |
| Thread Tools | |
| Display Modes | |
|
|