0

Hi..

I want to upload a file with help of FileUpload control, in which, i want to save the file with a specific name or say a name entered in a textbox on a same page.
for ex, if textbox contains "ABC" then the files should be uploaded with abc.jpg name.

how can i restrict user to select only specific types of file in a fileupload control?

also, how can i save an image in 3 different sizes at time of uploading?

when user selects an image, it should be saved in some specific size in a specified folder with the name as in textbox,,,

Thanks,

5
Contributors
10
Replies
13
Views
7 Years
Discussion Span
Last Post by Dhanya_1
0

hi.

I want the code in c#.net...i hav got the way to save the file with whtever name i want. i just want to know ho to store images in different size and how to use filter in fileupload control..

Thanks.

0

hii dude
you could upload a file in a folder by a random name and and the name should be store in the data base with their path
and whenever you need image you can call database path
and you got your image
thats it

0

Hey thanks..but instead of going for database, we can directly change its name in SaveAs() itself.

The only problem left is, how can i control filtering of file upload control. Is there any possible way to achieve it?

0

Use this in your event handler for clicking an upload button.

if (FileUpLoad1.HasFile)
{
    String fileName = "yourfilename";
    FileUpload1.PostedFile.SaveAs(Server.MapPath("yourpath/") + fileName);
}
0

yeah..thanks..it works fine...

The only problem left is, how to filter the upload control. its possible by coding, like checking the posted file's extension, but is it anyway possible to provide facility in the upload control itself?

do reply..thanks...

0

try this

if (fuResume.HasFile)
            {
                string ext = System.IO.Path.GetExtension(fuResume.PostedFile.FileName);
if (ext == ".doc" || ext == ".txt" || ext == ".rtf" || ext == ".pdf")
                    {
//do something here
}
}
-1

I want to upload a file with help of FileUpload control, in which, i want to save the file with a specific name or say a name entered in a textbox on a same page.
for ex, if textbox contains "ABC" then the files should be uploaded with abc.jpg name.

can u please provide the code for this asap.

Edited by Dhanya_1

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.