user1561923
user1561923

Reputation: 243

How to set a value for file upload button

I have an application where we can select image and store it and when user needs to change a properties of image like height,width,image he will go to edit page and he will edit it.. But when the user does not change image if he changes only height and width then the image will no display because the image value will not fetch/set for file... So how can we dynamically set path for a file upload button...

Upvotes: 0

Views: 1138

Answers (2)

user657496
user657496

Reputation:

Answer is simple; you cannot.

Just check whether the image is set. If so, upload the new image. If not, don't replace the image with the image you already have. This is a safety measure, you don't want to be able to upload a file of the websites choise.

Upvotes: 1

Hubro
Hubro

Reputation: 59383

If you're talking about the HTML file input then you can't manipulate it's contents programmatically. This is a safety feature in modern browsers. For all intents and purposes you can consider it read-only.

Specs on the HTML file input

Upvotes: 1

Related Questions