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,

In which language you feel comfort please reply with same post

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.

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

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?

can you paste your code here !

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

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

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...

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
}
}

Yeah..That works fine...

Thanks..

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.