??FileSystemObject?? and Multiple File uploads with VB.NET and ASP.NET

Posted on 2003-03-10
Medium Priority
Last Modified: 2012-06-27
Hi Guys

This is the scenario:

A website has many photo galleries of major events in it. These galleries consist of a table with gallery info and another table with image filename linking these images to the gallery. No brainpower needed to understand that part....

The physical images are being stored on the web server in a file system structure like the following:


"xxxxx.jpg" is the physical filename of the pic
"2003-02-28" is the date of the gallery
"galleryname" is the venue where the event happened

I now have various photographers which after their events they covered, go online, enter the event details which gets saved on the DB, and then they manually upload all picture files and manually create the folder above (via ftp). (just the date and galleryname parts).

1. Can this folder creation be automated WITHOUT completely comprimising security?

2. Can you have something where the user just lets say supply a folder name containing all local pics to upload, and then have the script automatically upload them to the server. So far I could just see how you MUST have a HTMLInputFile control for every file you want to upload. I need this to be variable as they can have 10, 20 and in most case over 50 to 100 photos to upload for one event.

3. In addition to this, I want them to be able to supply me with a "branding" filename, which will be a gif or jpeg, to be MERGED with the file being uploaded. This is for when an advertiser sponsored an event and we want his logo to appear on all pics. How do I do this?

I realise there is like 3 different questions here, but they all go hand in hand I think.

500 points up for grabs here, and if need be, if many ppl answer, when getting to an answer, i will award more point to ppl that helped.

(will split in 200 points for each answer if multiple ppl answer the different points)

thanks guys!


Question by:netraLINK
LVL 23

Accepted Solution

naveenkohli earned 660 total points
ID: 8103145
1. This process can be automated. You will have to give write permissions to atleast one user account on the folder where all the subfolders will be created. The form they will use to upload the image will have the fields that will get input about the "galleryname", "date". You will these values to create the folders. You will use classes from System.IO namespace to accomplish the stuff that you used to do with FileSystemObject.

// Get the physical path of directory...
string strDir = Server.MapPath("/images/gallery/2003-02-28/galleryname");
// Create the directory.
// Save the uploaded image..

2. This can't be done without the help of client side component. Your users will have to register some ActiveX component that you develop. It will loop through the files on client machines and upload.

3. This is doable. Along with the gallery picture, ask them to upload additional image file (branding). then use classes from System.Drawing & System.Drawing.Image namespace to recreate the image by merging 2.

Image obImg = Image.FromFile("xxxx.jpg");
Image obImgBranding = Image.Fromfile("brand.jpg");

Graphics g = Graphics.FromImage(obImg);
g.DrawImage(0, 0, obImgBranding );

The above code snippets are just illustrations. You may to look at the docs for actual implementations.
LVL 20

Assisted Solution

by:Michel Sakr
Michel Sakr earned 660 total points
ID: 8103262
2- it can be done.. by letting the user zip the files and you unzip them on the server side..
LVL 20

Expert Comment

by:Michel Sakr
ID: 8103266
[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

LVL 10

Assisted Solution

GoodJun earned 180 total points
ID: 8103370

Author Comment

ID: 8109181
Hi Guys

Firstly - naveenkohli
Number 3 - If that works - look like it should - the points yours - thanks man!
Number 1 - With my limited knowledge of web servers, I believe that I will have to give the IUSR on that machine write access to the root folder for my galleries. This is dangerous... I was thinking more in the line of creating a different account than the IUSR, then give that one write permissions, so that normal "surfers" do not have it. The people uploading these pics will be logging into a admin backend - also webbased (asp.net - vb) - so some kind of authentication can go in there too? Any suggestions?
Number 2 - example - cliend side component is a possibility...

Just a note - my hosting server is in the USA, im in South Africa. I do not have full admin access to the server, just normal hosting access.


Author Comment

ID: 8109188
and oh yeah...

Silvers5 - due to server being so far and no permissions, dont think ZIP would work. Also only one of the links you provided is for a free solution - and I dont think I will be able to get that to work with asp.net.

maybe im wrong?
LVL 20

Expert Comment

by:Michel Sakr
ID: 8109226

>authentication can go in there too? Any suggestions?

Use windows based authentication and tell the webserver admin to create a local account that have remote login permission and permissions over your root..
COnnect trhu ssl to the admin part
In all cases the administrator of the remote server might need to work with you closely (by phone.. email..chat) from minutes to hours!

2- client side component will work.. an activex will do the job or a java

>Silvers5 - due to server being so far and no permissions

I don't think you will be able to do anything if you don't have control over your application server(remotely or an admin there)

BTW check with the admin of your webserver.. they must have been disabled FIle access classes also for security..

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question