Uploading Files Via Http Using A Php Script

liunx

Guest
Hello everyone! I'm new here. Just moved to TCH from Omnis.crap <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> Rock Sign anyhow, one of my scripts that use to work won't work any more. This is the line that's having the error:<br />copy($HTTP_POST_FILES['name']['tmp_name'], "directory/file.jpg");<br /><br />I also tried this with no luck:<br />move_uploaded_file($HTTP_POST_FILES['name']['tmp_name'], "directory/file.jpg");<br /><br />Can anyone help me out? I keep getting the permission denied error. It's really boggling me!<br />Thanks in advance!<!--content-->
First thing is did you make sure that the directory you are uploading to has the permissions set to 777 <br />Chmod 777 is read write and execute permissions and is needed if users are to upload files. <br />here is a link that I was having problems with as well <br /><a href="http://www.totalchoicehosting.com/forums/index.php?showtopic=14770&hl=" target="_blank">upload files discussion</a><!--content-->
Welcome to the family, mangarevolution! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />That is correct. The folder you are uploading to must have 777 permissions for you to write your files.<!--content-->
Check out this link ... it might help: <a href="http://www.reducedcomplexity.com/scripts/uploader_class/?lang=en" target="_blank">http://www.reducedcomplexity.com/scripts/u..._class/?lang=en</a><!--content-->
alright!!!! Thanks!!!<br /> Rock Sign Rock Sign Rock Sign <br /><br />That absolutely worked! I simply changed the permissions and everything worked perfectly. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Thanks a lot for taking the time to help me guys, I really appreciate it. It's so great to have a support forum like this.<br /><br />And thank you for the warm welcome TCH-Bruce. I'm gonna love it here.<!--content-->
Welcome aboard, mangarevolution! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /><!--content-->
Welcome to your extended family mangarevolution <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
mangarevolution,<br /><br />Welcome to the forums and welcome to the family.<!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> Welcome to the Family <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> <br /><br />and your new home!<br /><br />We really are like family here.<br />So if you need anything,<br />just ask your new family!<br />We love to help <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
By the way, $HTTP_POST_FILES is deprecated, you should use $_POST instead <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Thanks for the kind welcomes everyone. I'm really loveing it here. You all know how to make a person feel welcome. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/group.gif" style="vertical-align:middle" emoid=":group:" border="0" alt="group.gif" /> <br /><br /><!--QuoteBegin-TCH-Raul+Dec 14 2004, 06:55 PM--><div class='quotetop'>QUOTE(TCH-Raul @ Dec 14 2004, 06:55 PM)</div><div class='quotemain'><!--QuoteEBegin-->By the way, $HTTP_POST_FILES is deprecated, you should use $_POST instead <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Raul, do you (or anyone else) know when this deprication will be fully implemented? I've got a lot of code to update, and want to know how urgent it might be.<br /><br />come to think of it, my cookie arrays haven't been working either. I bet they changed that as well. maybe it's just $_COOKIE now? haha. Guess I'll check on that. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/yes.gif" style="vertical-align:middle" emoid=":yes:" border="0" alt="yes.gif" /><!--content-->
<!--coloro:blue--><span style="color:blue"><!--/coloro-->$_COOKIE<!--colorc--></span><!--/colorc--> is correct.<!--content-->
thanks!<br />I'm gonna start replacing that right now.<br /><br />darn I hope it works... <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sweatdrop.gif" style="vertical-align:middle" emoid=":sweatdrop:" border="0" alt="sweatdrop.gif" /><!--content-->
I have no idea when it will be fully implemented.<br />I'd say it will work throughout all the 4.x series, or at least through the 4.3.x series.<br /><br />Does anyone know if PHP 5 still supports the old style global variables, like $HTTP_SERVER_VARS?<br /><br />Anyway, you could use some kind of editor or even a tool made specifically for this, to search and replace each and every $HTTP_SERVER_VARS by $_SERVER, etc <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
Raul,<br /><br />I think the variable they should be using is $_FILES<br /><br />From php website:<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->$_FILES<br /><br />    Variables provided to the script via HTTP post file uploads. Analogous to the old $HTTP_POST_FILES array (which is still available, but deprecated). See POST method uploads for more information.<!--QuoteEnd--></div><!--QuoteEEnd--><!--content-->
You're right, Jack.<br /><br />I used server_vars as an example and then just used it again but yes, the variable they should be using is $_FILES.<br /><br />Thanks for noticing it <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
 
Top