Uploaded file name is path via HTML and Javascript

I want to upload file by using HTML + javascript.

Although it works, uploaded file name is path name not the file name.

Here is my code to upload file...

HTML

<form id="upload_form" method='POST' enctype='multipart/form-data' action='http://127.0.0.1:8080/upload?Name=' >
    file upload: <input type="file" id="file" name="file">
    <input type="submit" value="Submit" onclick="UploadFile()"/>
</form>

JavaScript

function UploadFile()
{
   document.getElementById("upload_form").action = document.getElementById("upload_form").action + _fileName; 
   document.getElementById("upload_form").submit();        
}

If I choose "C:\Users\Desktop\test5.txt"

The uploaded file name will be "C:UsersDesktoptest5.txt"

How can I change the file name to be "test5.txt" only

Answers


Just reference here there are some tips for u to follow

http://stackoverflow.com/questions/2200100/input-type-file-for-ie-gives-full-path-need-file-name-only

Need Your Help

How to apply line breaks in JLabels?

java swing user-interface jlabel

Please have a look at the following code

EF 4 Code First - Combine Views and Tables

entity-framework c#-4.0 views ef-code-first

I researched this question for days and cannot seem to find an option I feel good about; however, here is a link to a very similar question:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.