Get The Original Path From A Cuploadedfile


I’d like to get the original path from a CUploadedFile, is it possible? Something like “/Users/user_name/Documents/my_photo.jpg”

Because I want to store in a session variable the file path and upload it at another moment.

I hope it is possible, thanks!

If you’re talking about the path on client’s computer, it’s not possible because of security issues.

But you can upload the file to some temporary folder and store its location to session.

PS. I suppose you’re trying to keep the file in case of form validation errors, right? :)


And ok, I saw this method but I wanted to be sure that we can’t get the original path.


Btw a long time ago I have managed to get this path.

And I’m pretty sure it was IE 5 or 6 who allowed me to get it.

But this is a serious security bug (one can steal any file from system), so modern browsers don’t allow it (at least I hope so)