visitors uploading pictures

visitors uploading pictures

Posted by: Number3
Posted on: 2005-08-31 00:10:00

Hello,

I am trying to implement a feature on my website where user's can upload pictures from their hard disk. I will then place the path to the file in one of my tables for reference.

I currently have this:


<form name="addArticle" method="post" action="myform.php" class="form" ENCTYPE="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="file" name="artPicture" tabindex="8">
</form>

My problem is that I do not know what location the file is uploaded to.

Does anyone know the location the file are uploaded to?

Thanks in advance

Re: visitors uploading pictures

Posted by: scjessey
Posted on: 2005-08-31 07:57:00

In reply to:

My problem is that I do not know what location the file is uploaded to.


Assuming you are using PHP, the information you need can be found in the $_FILES array created during the upload process. For example:

$_FILES['userfile']['name']           -- original filename
$_FILES['userfile']['tmp_name'] -- path and filename of temporary file
$_FILES['userfile']['size'] -- size of file (in bytes)
$_FILES['userfile']['type'] -- MIME type of file

To move it from the temporary location to a new location, create a variable that holds the new path and filename (I've used $filename), and use the following:

move_uploaded_file($_FILES['userfile']['tmp_name'], $filename);

The file will now be in the new location and renamed, according to whatever you chose for the $filename variable.

Re: visitors uploading pictures

Posted by: Number3
Posted on: 2005-08-31 20:40:00

Thanks for the response.

I have anohter question, what format is the path to where you want to move the uploaded file too? (and yes I am useing php)


Re: visitors uploading pictures

Posted by: Number3
Posted on: 2005-08-31 21:32:00

Actually, I got my issue resolved.

:D!!!

Tags: upload pictureshard diskpathreference