sbrinley Posted May 14, 2009 Share Posted May 14, 2009 How can I allow the user to use a browser interface like the html form upload browse to allow the user to select a file to get the local path (actually a mapped network drive on a corporate file server) Here is an example: User A wants to link the company org chart to everyone. They log onto the internal internet page, choose the file at this location for example z:/hr/orgchart.ppt by browsing, they submit the file. User B goes to the page and clicks the link to view. instead of going to a directory on the web server as if someone uploaded the file they are pointed to z:/hr/orgchart.ppt The point of this is to eliminate users from putting files on both the file server and web server. Maybe I'm going about this in the wrong way but basically I just need users to select a path of a file by browsing then have that path posted as a link on a page. This is a corp network. Users would be pointing files to a mapped network drive that is shared and security is provided by active directory. User A might know where the file is located but they don't know the full path and or file extension on the file. My end goal is to allow users to link their own files instead of me manually linking them or changing links every time a file version changes or they wish to add more files. I also don't want to eat up space on a web server by having users upload files that already exist on the file server. (why way disk space or backup tape drive space) I originally started out asking for help in PHP here is a link to the thread http://www.phpfreaks.com/forums/index.php/topic,251884.0.html. It seems I can't get the information through PHP so I'm hoping java can help. p.s I'm a complete noob when it comes to java. Quote Link to comment Share on other sites More sharing options...
Adam Posted May 14, 2009 Share Posted May 14, 2009 You could still upload the file with PHP, but just not copy it from temporary memory? Obviously then you can take the file path info from the $_FILES array and store it in a database or, however you plan to store the data. Quote Link to comment Share on other sites More sharing options...
sbrinley Posted May 14, 2009 Author Share Posted May 14, 2009 that is true but if you look at the global variable $_FILES it will only show the file name not the actual path. On a side note I've done some more digging and found that with this <form> <textarea name='abc' rows=30 cols=50></textarea> <input type=file onchange="this.form.abc.value+=';' + this.value; return true;" multiple> </form> In firefox 3 I will get the name of the file just like the $_FILES however with IE8 I get this on the left side ;C:\fakepath\SNC00102.jpg here's a screen shot. The actually path of the file selected is c:\downloads\SNC00102.jpg as you can see from the screen shot... Quote Link to comment Share on other sites More sharing options...
sbrinley Posted May 14, 2009 Author Share Posted May 14, 2009 I decided to move on to the next part of the project assuming I could get this to work which is linking the files to a path. It seems IE7, IE8 and firefox have local access links disabled. I have found a few solutions to enable them but this opens a huge security risk and is somewhat time consuming. I'm going to mark this question as solved since there isn't a solution / even if this works it can't go anywhere. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Adam Posted May 15, 2009 Share Posted May 15, 2009 Ah clever, I didn't think of that! Of course it does require JavaScript, but in a controlled environment that wouldn't have been a problem. Just to add as well in case anyone else is trying something similar, if you use the method above to place the full file path into a hidden field using JS, if you don't use the enctype attribute on the <form>, then it won't upload the file (obviously saving time and resources). Are you sure it can't be done without security issues? On the network at work we have pretty high security and I've never had a problem accessing local files... Quote Link to comment Share on other sites More sharing options...
sbrinley Posted May 15, 2009 Author Share Posted May 15, 2009 There's not a problem if you go through windows explorer but it you go through internet explorer or firefox (which is what my users use) then it doesn't work. Also there's the slight issue of providing the full path instead of the c:/fakepath that populates. I did a calculation and all the files that would be uploaded total less then 1GB and I can't imagine even in the future going over 2GB so it should be that big of an issue. The users won't know the difference and the only real issue with going that way is inconsistency of data. If people don't update the file on the internal website as well as the local files then there could be issues. Quote Link to comment 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.