Hello everyone out there,
I'm really a newbie in PHP and programming, but I've been tasked to do up an upload function for my company's portal.
I'm extremely confused with how I should go about doing this:
1.transferring a file to a temporary location (either through mySQL_query=INSERTINTO table WHERE customerid='xxx' ,or through this tedious process of POST method uploads)
2.retrieving it from there so that it can be displayed on the screen (through mySQL_query=SELECTFROM table WHERE customerid='xxx', or through this tedious process of validating the file upload, and whatever steps after that).
My understanding of this POST method uploads process is as follows:
First is getting the user to fill in a form.
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="URL" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
I took this form from PHPBuilder.com. I've 2 questions for this part.
Firstly, for the URL: does it refer to the .php file that is supposed to take the "userfile" from the form?
Secondly, for this $_FILES global variable, all I understand is that the contents of it are:
$FILES['userfile']['name']
$FILES['userfile']['type']
$FILES['userfile']['size']
$FILES['userfile']['tmp_name']
$_FILES['userfile']['error']
Sorry for my ignorance, but how can these contents be used in the subsequent processes for file uploading?
Then, what are the steps required for the rest of the upload process? I've attached an upload file that the previous intern did.
Hope it is of help as I don't understand the basic coding.
Frustrated,
jose9