Ajay
Ajay

Reputation: 370

Remove file from input field

I am working on file uploading. So when I click cross button how can I remove exited file using php without page reload?

enter image description here

Upvotes: 0

Views: 3170

Answers (3)

Alex
Alex

Reputation: 7688

jQuery version

$("#id").attr('value', ''); or $("#id").val('');

Also check out this article: http://www.learningjquery.com/2007/08/clearing-form-data

Upvotes: 2

mgraph
mgraph

Reputation: 15338

if you're using jQuery:

$("#remove").click(function(){
   $("#fileInput").val("");
   return false;
})

Upvotes: -1

Martin.
Martin.

Reputation: 10539

You can, with javascript

document.getElementById("fileInput").value = "";

How can I remove exited file using php without page reload?

You can't, PHP is server side language

Upvotes: 8

Related Questions