Help with uploading a file...

This is a discussion on Help with uploading a file... within the PHP Language forums, part of the PHP Programming Forums category; Hi, I need some assistance again... I have a simple upload form from manual that goes like this: <form ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-07-2005
Six
 
Posts: n/a
Default Help with uploading a file...

Hi, I need some assistance again...

I have a simple upload form from manual that goes like this:

<form enctype="multipart/form-data" action="list.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>

list.php then searches "/upload" and lists all the files found in there.

Now, what I need is to tell it where to upload a file :)
By default, tutorial says, files are in /var/www/tmp.
My web server doesn't even have this directory.
I tried doing some search in various tmp folders but found none of the
uploaded files. I expected it to see in the directory from which I
executed the form.. but... umm... no. Nothing there as well.

Just whem I was about to to phpinfo(); to search for the patch for
storing temp uploaded files server crashed... damn shared hosting.
So I have to wait for admins to bring it back online...

By the way, I can't try 'move_uploaded_file($_FILE['something'...
because the PHP version installed is not > or == 4.1.0 :((
I think it's 4.0.6 but I don't think it's that important.
Suggested solution was "$HTTP_UPLOADED_FILE" if I recall right...
.... but that failed to work for me as well :((

Anyone has any ideas?

Thanks in advance,
Six


P.S. I was just trying to make a simple file upload script. Nothing
fancy. Just to allow several people to send something to me via web...
Reply With Quote
  #2 (permalink)  
Old 01-07-2005
Markus L.
 
Posts: n/a
Default Re: Help with uploading a file...

Six wrote:
> Hi, I need some assistance again...
>
> I have a simple upload form from manual that goes like this:
>
> <form enctype="multipart/form-data" action="list.php" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE" value="100000">
> Send this file: <input name="userfile" type="file">
> <input type="submit" value="Send File">
> </form>
>
> list.php then searches "/upload" and lists all the files found in there.
>
> Now, what I need is to tell it where to upload a file :)
> By default, tutorial says, files are in /var/www/tmp.
> My web server doesn't even have this directory.
> I tried doing some search in various tmp folders but found none of the
> uploaded files. I expected it to see in the directory from which I
> executed the form.. but... umm... no. Nothing there as well.
>
> Just whem I was about to to phpinfo(); to search for the patch for
> storing temp uploaded files server crashed... damn shared hosting.
> So I have to wait for admins to bring it back online...
>
> By the way, I can't try 'move_uploaded_file($_FILE['something'...
> because the PHP version installed is not > or == 4.1.0 :((
> I think it's 4.0.6 but I don't think it's that important.
> Suggested solution was "$HTTP_UPLOADED_FILE" if I recall right...
> ... but that failed to work for me as well :((
>
> Anyone has any ideas?
>
> Thanks in advance,
> Six
>
>
> P.S. I was just trying to make a simple file upload script. Nothing
> fancy. Just to allow several people to send something to me via web...


The location where the file is stored is saved in
$_FILES['userfile']['tmp_name'].

To copy the file from this temporary directory to another location do this:
copy($_FILE['userfile']['tmp_name'], 'C:\' . $_FILE['userfile']['name']);

The file which is located at $_FILE['userfile']['tmp_name'] is deleted
after the script ends.


--
-------------------------------------------------------
Try this: SCA the Smart Class Archive for PHP
http://www.project-sca.org
-------------------------------------------------------
Reply With Quote
  #3 (permalink)  
Old 01-09-2005
Six
 
Posts: n/a
Default Re: Help with uploading a file...

-> Markus L. ->
> The location where the file is stored is saved in
> $_FILES['userfile']['tmp_name'].
>
> To copy the file from this temporary directory to another location do this:
> copy($_FILE['userfile']['tmp_name'], 'C:\' . $_FILE['userfile']['name']);
>
> The file which is located at $_FILE['userfile']['tmp_name'] is deleted
> after the script ends.


Please take a look at the part of my original post:
> > By the way, I can't try 'move_uploaded_file($_FILE['something'...
> > because the PHP version installed is not > or == 4.1.0 :((
> > I think it's 4.0.6 but I don't think it's that important.
> > Suggested solution was "$HTTP_UPLOADED_FILE" if I recall right...
> > ... but that failed to work for me as well :((


:(
But thanks for trying to help.

Bay the way, I found the almost perfect solution at
http://www.maaking.com/index.php?loadpage=scripts

I acutally had to change only one single lettes, but that was the buggy
part that was driving me mad :) LOL I guess develeoper didn't test the
script onder PHP < 4.1.0 :)

--
http://www.extremko.co.uk

Super-extra-naj_naj-fenomenalni-ultra-magicni-virtuelni-
-svemirski-extremni-master-fantasticni-dzedaj sajt :o)

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:22 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0