Jump to content

File Upload


Krismmm

Recommended Posts

Hi there,

 

im trying to build a file upload form something like this

 

just simple HTML,

 

<HTML>

<HEAD>

<TITLE>File Uploading Interface</TITLE>

</HEAD>

<BODY>

<CENTER>

<BR><BR>

<FORM ENCTYPE="multipart/form-data" NAME=MyForm ACTION=submit.php METHOD="POST">

<INPUT TYPE="hidden" NAME="command" VALUE="1">

<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000">

<TABLE>

<TR>

<TD>Choose File</TD>

<TD><INPUT NAME="MyFile" TYPE="File"></TD>

</TR>

<TR>

<TD COLSPAN="2"><INPUT NAME="submit" VALUE="Upload" TYPE="submit"></TD>

</TR>

</TABLE>

</FORM>

</CENTER>

</BODY>

</HTML>

 

But please not i do not wish to upload a file only grab the File location e.g 'C:\Temp\File1.csv'

there is never actually a file uploaded.

 

so i got the UI no problems, however im not sure if i want to be using a POST method,

 

my ultimate goal is to use the browse button, select a file to be uploaded

pass it as a string and use the php function to change my windows slashes \

to php slashes / and just pass the whole field e.g (C:\temp\file1.csv) then (C:/temp/file1.csv)

as a variable to some code that reads each line of a CSV file that i have made and that

requries the file location. So if all of this happens on one page this is fine i dont need to go to another

page however a message "Upload complete" for example would be excellent.

 

Please assist

 

Thanks

 

Kris

Link to comment
https://forums.phpfreaks.com/topic/53342-file-upload/
Share on other sites

All uploaded files go in to a  temp folder with a random Hash as a file name.  You can then open said file using File handlers and I believe said file is destroyed outta the temp folder after X time.

 

Otherwise take the file say it using a random number hash to a temp folder then open said file take what you need and make a server script to auto clean temp folder every night

Link to comment
https://forums.phpfreaks.com/topic/53342-file-upload/#findComment-263625
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.