Reputation: 3
I need to rename file on client side as per client requirement. I understand FF,Chrome doesn't provide File Path and IE provides with File path option enabled on that region.
With all these setting I am getting filepath From uploadedFile.PostedFile.FileName
;
Now When I call File.Move(stroldfilename, strNewfilename)
, it is looking for that file on server machine and not client machine.
Please advice .
For example File path is C:\Test.dat
.
Upvotes: 0
Views: 665
Reputation: 21
I solved this by following http://www.roseindia.net/javascript/javascriptexamples/javascript-move-file.shtml
It does not work on FF or Chrome however does work with IE . Some seetings are required for this . Try (in IE) Going to Tools --> Internet options --> Security --> Custom Level and under the ActiveX controls and plug-ins, then enable "Initialize and script ActiveX controls not marked as safe for scripting.
I completely understandthat it is security disaster but it is working since more than a month . Some time you get client like such :-).
Posting it here as i lost my login information and recreated another user .
Upvotes: 0
Reputation: 249
You cannot move a client-side file from the server. The move would have to occur on the client itself. You should be able to Google "JavaScript File Move" for examples of doing so on the client through JavaScript. Here is one example: http://www.roseindia.net/javascript/javascriptexamples/javascript-move-file.shtml
Upvotes: 0
Reputation: 13443
The server does not have access to the file system on the client side, and as such it cannot rename a file on the client side. This would cause major security issues as web sites would be able to change files on the client OS.
You may just want to save the file on the server with a different name after you've received it on the server.
Upvotes: 2
Reputation: 2852
You cannot move/edit files on the client side from browser. However, user can upload a file and later save the same file wherever he wants to.
Upvotes: 1