I want to clear the file path from the file upload. The file upload is inside the update panel and I am using a AsyncFileUpload
. How can I clear the file and change the background color of the fileupload
btnAudUpload_Click Method
string filename =FileUpload.FileName;
string Fullpath = Path.Combine(@"D:\Media", filename);
if (FileUpload.HasFile)
{
if (filename.ToLower().EndsWith("mp4"))
{
//Saving the file
}
else
{
//I want to clear the FileUpload content here
}
}
bind('focus', function() { // Clear any files currently selected in #upload-file $('#upload-file'). val(''); }) ; // Choose uploading new one - this works ok $('#upload-file'). bind('focus', function() { // Clear any files currently selected in #select-file $('#select-file').
Add the functionality of clearing the hasfile property in the LoadPage() function which ,suprise suprise, is called when you refresh (as the page loads). try to deal with the issue immediately after uploading the file.
Clear the Attributes worked for me... but that will remove styles and other stuff
string filename =FileUpload.FileName;
string Fullpath = Path.Combine(@"D:\Media", filename);
if (FileUpload.HasFile)
{
if (filename.ToLower().EndsWith("mp4"))
{
//Saving the file
}
else
{
//I want to clear the FileUpload content here
FileUpload.Attributes.Clear();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With