?
Solved

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

Posted on 2003-03-10
7
Medium Priority
?
261 Views
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:

/images/gallery/2003-02-28/galleryname/xxxxx.jpg

"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!

netraLINK

0
Comment
Question by:netraLINK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 23

Accepted Solution

by:
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.
Directory.CreateDirectory(strDir));
// Save the uploaded image..
HtmlInputFileCtl.PostedFile.SaveAs(strDir+"xxxx.jpg");

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.
0
 
LVL 20

Assisted Solution

by:Silvers5
Silvers5 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..
http://www.123aspx.com/redir.aspx?res=29878
http://www.123aspx.com/redir.aspx?res=27383
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 8103266
0
How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

 
LVL 10

Assisted Solution

by:GoodJun
GoodJun earned 180 total points
ID: 8103370
listening...
0
 

Author Comment

by:netraLINK
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.

Thanks!
0
 

Author Comment

by:netraLINK
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?
0
 
LVL 20

Expert Comment

by:Silvers5
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..
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 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