...

View Full Version : How can I capture the file-path from a form rather than the file itself??



mOrloff
03-02-2011, 01:09 AM
I've got a huge stack of spreadsheets that I need to do some repetitive work on.

I'm writing a little script to will help out with this, and instead of hard-coding the path of each file into the script one at a time, I'd like to be able to browse to a target file.
Much like using an <input type="file"> form input, but without actually "uploading" it. All I need is the path (which will be relative to and accessible by the server).

Does anyone know how to capture the path on submit rather than uploading the file?

Thanks-a-bunch,
~ Mo

bullant
03-02-2011, 02:37 AM
One option is you could use something like scandir (http://php.net/manual/en/function.scandir.php) or glob (http://au.php.net/manual/en/function.glob.php) to generate a <select> of filenames or a list of filenames with checkboxes from which the user can select which files they want to process.

oesxyl
03-02-2011, 03:22 AM
One option is you could use something like scandir (http://php.net/manual/en/function.scandir.php) or glob (http://au.php.net/manual/en/function.glob.php) to generate a <select> of filenames or a list of filenames with checkboxes from which the user can select which files they want to process.
will work but only if the browser owner is the server owner and the server is local, :)

best regards

bullant
03-02-2011, 03:27 AM
Since the op said


All I need is the path (which will be relative to and accessible by the server).


it should work :)

oesxyl
03-02-2011, 03:40 AM
it should work :)
i didn't say that would not work, :)

best regards

bullant
03-02-2011, 03:53 AM
I just clarified why I think it should work (it's no big deal), but I don't know exactly where on the server the files are located. The op, if they choose to, can try it. If it works, all well and good. If it doesn't then they'll have to come up with a plan B :)

mOrloff
03-02-2011, 07:16 PM
Great, thanks-a-bunch.
Thanks Inigo, I'll look at JS (& flash) next.
Thanks bullant, for putting me on the scandir and glob path.
Thanks oesxyl, for pointing that out. That helped with my strategy.

~ Mo

Inigoesdr
03-02-2011, 11:51 PM
Thanks Inigo, I'll look at JS (& flash) next.

That isn't necessary, I missed the part in your post where you wanted to list the directories on the server. bullant pointed you in the right direction.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum