Forums

PHP

This topic is locked

Store PATH to a file on the network on MySQL

Posted 22 Mar 2002 17:35:11
1
has voted
22 Mar 2002 17:35:11 Julio Taylor posted:
i'm trying to set up a system where users within a LAN can attach files to customer database. What i need is a form where they can click on the "Browse" button and select a file. The system then stores the PATH (e.g. \\intranetserver\documents\account.xls) in the field, which will later be used as a hyperlink. I've been trying to use the "file" form element in Ultradev but all that does is store some manky .TMP file path without slashes. I don't need it to upload anything, simply store the absolute path to it on the network.

Is there a way to either make the "file" form element store its screen value or maybe create a separate browse function to store it in a normal text box? All i need is to save the users from typing the actual address.

Thanks!

Replies

Replied 17 Dec 2005 00:37:35
17 Dec 2005 00:37:35 chris w replied:
Did you ever find a way of doing this??

I am experimenting with a method based on the http_upload system which kinda works but relies on actually uploading a copy of the file to the server - grabbing the original path and then deleting the /tmp/uploaded_file

It sort of does the job, but seems very wasteful, especially as some of the files are over 100megs in size and all I need is their location on the file tree.

Any suggestions??

chrisw


Quote
i'm trying to set up a system where users within a LAN can attach files to customer database. What i need is a form where they can click on the "Browse" button and select a file. The system then stores the PATH (e.g. \\intranetserver\documents\account.xls) in the field, which will later be used as a hyperlink. I've been trying to use the "file" form element in Ultradev but all that does is store some manky .TMP file path without slashes. I don't need it to upload anything, simply store the absolute path to it on the network.

Is there a way to either make the "file" form element store its screen value or maybe create a separate browse function to store it in a normal text box? All i need is to save the users from typing the actual address.


Edited by - webboss on 17 Dec 2005 00:38:51
Replied 17 Dec 2005 01:42:20
17 Dec 2005 01:42:20 chris w replied:
And the answer is.... <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>



<pre id=code><font face=courier size=2 id=code>&lt;?

$file=$_POST['file'];
echo "[$file]";
$path=$_POST['path'];
echo "[$path]";

?&gt;
&lt;form method="post"&gt;
&lt;input type="file" name="file" onchange="document.forms [0].path.value=document.forms[0].file.value"&gt;
&lt;input type="hidden" name="path" value=""&gt;
&lt;input type="submit"&gt;
&lt;/form&gt; </font id=code></pre id=code>
Replied 17 Dec 2005 01:52:06
17 Dec 2005 01:52:06 chris w replied:
The hidden field by the way, is needed because although IE passes the full filepath from the text box, mozzilla passes only the file name, not the whole path.

By using the javascript onchange against the text value of the file box, the actual full path text is assigned to the hidden field - named path path which does submit correctly with both IE and Mozzilla

Sometimes the easiest solutions...

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic