adrianTNT Posted August 27, 2007 Share Posted August 27, 2007 I need a way to find the full path of a file uploaded by file upload form box. $_FILES['file1']['name'] gives just file name. I have a file upload form and if the user submitted something wrong I want the page to go back and have the forms maintain its values (the full path to local file, e.g: "c:/docs/landscape.jpg"). Any way to do that? This is a more complex applications so using another upload tool is not an option. Any ideas? Thanks. - Adrian. Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/ Share on other sites More sharing options...
thryb Posted August 27, 2007 Share Posted August 27, 2007 What version of php are you using ? There is a bug on that on previous version. See http://bugs.php.net/bug.php?id=13936 Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/#findComment-335224 Share on other sites More sharing options...
chronister Posted August 27, 2007 Share Posted August 27, 2007 To the best of my knowledge, you cannot specify a value for a file field. I have looked into this as well, It just wont work as far as I know. I could be wrong and actually hope I am as this would be cool. Nate Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/#findComment-335233 Share on other sites More sharing options...
Ninjakreborn Posted August 27, 2007 Share Posted August 27, 2007 Well it depends on what you mean. You can database the name of the file, for example the path. Use document root server variable to help track part of it, the rest is normally custom anyway. If you are wanting to set it in the form, add another field for the path and make it a hidden form field, it's an easy way to track what form it's coming from. If you meant something else, please re-specify. Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/#findComment-335234 Share on other sites More sharing options...
adrianTNT Posted August 27, 2007 Author Share Posted August 27, 2007 Thanks for the replies. So I understand the best way is to create another hidden form field and to copy the value from file field to this hidden field. Will this work? Anyone knows how the JavaScript for this should look? Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/#findComment-335338 Share on other sites More sharing options...
adrianTNT Posted August 27, 2007 Author Share Posted August 27, 2007 After I duplicated the "full path" of file upload fields so I can access it, I found that you cannot set a default path to file (in file upload fields) so I will have to drop the idea. As I said I wanted to set the default value in that form if user previously submitted an upload form but he was sent back. Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/#findComment-335412 Share on other sites More sharing options...
chronister Posted August 27, 2007 Share Posted August 27, 2007 Thats basically what I said... a default value cannot be set.... what was suggested is to use a hidden form field to keep this information, but it really don't help as the user will still have to navigate to the file again anyway. Nate Quote Link to comment https://forums.phpfreaks.com/topic/66876-how-to-find-full-path-of-a-file-upload-field-in-a-form-_filesfile1/#findComment-335472 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.