Krismmm Posted May 29, 2007 Share Posted May 29, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/53342-file-upload/ Share on other sites More sharing options...
cooldude832 Posted May 29, 2007 Share Posted May 29, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/53342-file-upload/#findComment-263625 Share on other sites More sharing options...
Krismmm Posted May 29, 2007 Author Share Posted May 29, 2007 hi and thanks for your response, i think i may have been confusing you. i actually dont want to upload the file i only simply want the browse box then when i push upload want to grab the path in the text box as a varible and pass it into another statement. Please assist. Quote Link to comment https://forums.phpfreaks.com/topic/53342-file-upload/#findComment-263667 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 form.html <form action="action.php" method="post"> File: <input name="fileurl" type="file" /> <input name="submit" type="submit" value="Upload" /> </form> action.php <?php if(isset($_POST["submit"])) { $fileurl = $_POST["fileurl"]; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/53342-file-upload/#findComment-264511 Share on other sites More sharing options...
Krismmm Posted May 31, 2007 Author Share Posted May 31, 2007 Thanks very much! is this possible to occur on page only? or am i pushing my luck now? your help is much apprectiated ??? Quote Link to comment https://forums.phpfreaks.com/topic/53342-file-upload/#findComment-265373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.