We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to get the modified uploaded file name in server side while delete a file?

How to modify uploaded file name and delete the modified file in Uploadbox?

Description:

In the UploadBox save process, let us assume that a file is uploaded to server and after some modifications, save the file with another name in the server. Now when that file is required to be deleted from the server using the UploadBox, it cannot be done using the old name. So, the modified name from the server is required during the file delete process. 

 
Solution:

To get started with this example, refer to the Getting Started section in the Uploadbox’s UG documentation and create a basic UploadBox example.

In the Save handler, the uploaded file name is altered and saved in a location in the server.  Now that is done, the updated name along with original name is returned to the UploadBox as a JSON. Refer to the following code.

 

The client-side “Success” event will be triggered when each upload action is successful. In that event, the JSON returned from the server with the modified file name can be accessed and added as a new attribute to the span element of the corresponding li element. Refer to the following code: 

 

After the new name is added to the uploadbox as an attribute, some changes in the UploadBox’s internal _xhrOnRemove method are required to access the new name instead of the old value. Refer to the following code.

 

Sample

Article ID: Published Date: Last Revised Date: Platform: Control:
8387 02/08/2018 02/08/2018 ASP.NET MVC Uploadbox
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.