Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Design question!, uploading documents to webserver

Reply
Thread Tools

Design question!, uploading documents to webserver

 
 
Jeff
Guest
Posts: n/a
 
      11-24-2008
Hi

asp.net 2.0

I'm developing a webportal, where admins will upload documents related to
users of the website.
Each document will be unique for each user. A user can have from 0 to many
documents.
An user only have access to his documents.

Documents will be in .pdf format.

Documents will not be stored in database (sqlserve2005) but instead uploaded
to a folder on the webserver. So I'm thinking should I create a folder for
each user on the webserver (make some logic that create folder, permission
problem at creating folder?) or modify document name to also hold the id of
the user, which I guess is a potential pitfall....

any suggestons? maybe there are better wasys of doing this? Upload to the
database instead (possible with pdf)? I guess changing the logic to save
file in the db is better, though not sure how to view a .pdf file stored in
the database (I know how to view images stored in database, so I guess the
procedure is the same for pdf also)

any suggestions?


 
Reply With Quote
 
 
 
 
Paul Shapiro
Guest
Posts: n/a
 
      11-24-2008
Storing pdf's in the db doesn't seem to resolve the security issue, since it
leaves all access through your web application, and the web application has
to handle the security. If the app is doing that anyway, you could store the
docs in a folder that no user has access to, and let the app provide the
docs on request. Then the app can do the same security controls it would
have done with the docs in the db.

"Jeff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> asp.net 2.0
>
> I'm developing a webportal, where admins will upload documents related to
> users of the website.
> Each document will be unique for each user. A user can have from 0 to many
> documents.
> An user only have access to his documents.
>
> Documents will be in .pdf format.
>
> Documents will not be stored in database (sqlserve2005) but instead
> uploaded to a folder on the webserver. So I'm thinking should I create a
> folder for each user on the webserver (make some logic that create folder,
> permission problem at creating folder?) or modify document name to also
> hold the id of the user, which I guess is a potential pitfall....
>
> any suggestons? maybe there are better wasys of doing this? Upload to the
> database instead (possible with pdf)? I guess changing the logic to save
> file in the db is better, though not sure how to view a .pdf file stored
> in the database (I know how to view images stored in database, so I guess
> the procedure is the same for pdf also)
>
> any suggestions?


 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      11-24-2008
The way i do it.
1. Create tblUpload table with columns like ('UploadId (identity), FileName,
UserId, DateUploaded, Tags.....)
2. when file is uploaded record is created in tblUpload with proper values
and file is saved into folder /Upload/{UploadId}.pdf
3. When ever users looks at his files he gets a link to it /myfile.ashx?id=3
for example. The myfile.ashx checks user's permissions and sends back file
using Response.WriteFile and setting appropriate name with setting
'Content-Disposition' in a header. To set name of the downloaded file
appropriately. See http://support.microsoft.com/kb/260519

A. Users will not even know about /Upload/ folder existense.
B. A little more work since the table creating involved but you win in a
long run since now you can attach some metadata to the file. Like small
description...
C. You might want to create subfolders in Upload folder. All depends on your
design and amount of file. It can be by UserId.
It can be by MonthYear like /Upload/200811/{UploadId}.pdf. Depends on what
is being uploaded. MonthYear is perfect for sales data. And allows easy to
backup and remove the whole year. UserId aproach is perfect when you have a
lot of files per user.


George.


"Jeff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> asp.net 2.0
>
> I'm developing a webportal, where admins will upload documents related to
> users of the website.
> Each document will be unique for each user. A user can have from 0 to many
> documents.
> An user only have access to his documents.
>
> Documents will be in .pdf format.
>
> Documents will not be stored in database (sqlserve2005) but instead
> uploaded to a folder on the webserver. So I'm thinking should I create a
> folder for each user on the webserver (make some logic that create folder,
> permission problem at creating folder?) or modify document name to also
> hold the id of the user, which I guess is a potential pitfall....
>
> any suggestons? maybe there are better wasys of doing this? Upload to the
> database instead (possible with pdf)? I guess changing the logic to save
> file in the db is better, though not sure how to view a .pdf file stored
> in the database (I know how to view images stored in database, so I guess
> the procedure is the same for pdf also)
>
> any suggestions?
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Uploading MS Word Documents GaryDean ASP .Net 2 08-06-2007 01:00 AM
No more stuff on C:\Documents and Settings\[User]\My Documents\Visual Studio 2005\ craigkenisston@hotmail.com ASP .Net 1 10-18-2006 03:31 PM
ftp uploading vs. control panel uploading Dung Ping HTML 10 01-16-2006 10:43 AM
uploading documents balasubramanyam_pendyala@hotmail.com ASP .Net Web Services 0 12-27-2005 02:24 PM
Problem Uploading templated documents to SQL Server in ASP.net Lou ASP .Net 1 08-17-2004 04:01 AM



Advertisments