0

I have a directory that contains a csv file and avatar images.

The contents of csv file are as

Id    Name    Avatar        Dept        School
1     Mark    01019.jpg     Market      None
2     John    21122.jpg     Business    None
3     Sam     33311.jpg     IT          None
....
....
50    James   9823.jpg      IT          USA

The avatar images are placed in the same folder of csv file.

What I want is that when a user uploads csv file, then the info in file is converted into business objects, say Person. I can upload and parse the csv to get Id, Name, Dept, School, but ofcourse cant make it upload avatar images (in the csv file) to server, in same web request.

What are the possible ways to achieve this? Assume that I want to avoid zipping all images+csv in a single .zip file and then upload it on server.

Thanks.

1 Answer 1

1

I just love when people end their question by excluding the only possible solution.

The server (where your web application is running) has no direct access to the client (where the files are). The only thing the server can work with is what the client chooses to give it. So, your option is to have the user upload each image file invidually, along with the CSV, or to zip it all up, so they can send everything in a single upload. That's it. Period. At least with a standard web page.

You can of course create a Java applet or a Flash application that the user would authorize to access their filesystem to retrieve the necessary files. Essentially, the process is still the same, it's just the Java/Flash app would automatically do the file uploads instead of requiring the user to manually do them. However, both Java (on the web) and Flash are all but dead technologies at this point, so by using either of those, you're creating a dependency on something that is constantly exploited and not guaranteed to continue to receive security patches for the life of your application. Flash, in particular, has already been end-of-lifed, so Adobe will abandon support entirely within the next few years, max.

Long and short, tell your user to zip it up and upload a zip file.

Sign up to request clarification or add additional context in comments.

1 Comment

I agree. It seems to be the only way if not using flash/java. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.