Restricting File Uploads

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
Is there any way it is possible to restrict the type of file uploaded using
the file upload function within a form?

I need to force users to upload files of one type i.e .jpg as uploading .bmp
images is causing problems with the forum software I am using (apart from the
obvious file size implications)

Thanks for taking the time to read this posting. Andy
 
Not with the std FP file upload component

Check w/ your host to see if they support ASP and a File Upload component
You could do an ASP file upload and add ASP to delete all but .jpg files (after the upload)
- if the host supports a file use their script recommendation
Otherwise See http://support.microsoft.com/kb/299692/EN-US/

Then modify the code for the UploadFile.asp to be

If Err.number = 0 Then
For Each File in fuFile.Files
Ext = UCase(Right(fuFile.FileName, 3))
If Ext <> "JPG" Then
File.Delete
strMsg = "Illegal File NOT UpLoaded"
Else
strMsg = fuFile.FileName & " was uploaded successfully."
End If
Next
Else
.... .....

--




| Hi all,
| Is there any way it is possible to restrict the type of file uploaded using
| the file upload function within a form?
|
| I need to force users to upload files of one type i.e .jpg as uploading .bmp
| images is causing problems with the forum software I am using (apart from the
| obvious file size implications)
|
| Thanks for taking the time to read this posting. Andy
 
Thanks Stefan,

Much appreciated but having looked more into setting up .asp uploading I'll
hold back until I feel a bit more confident!

There goes my hopes for an easy solution! ;-)

All the best, Andy
 
Try adding multiple File upload form elements

--




| Dear Stefan,
| How can I upload mutiple files in one upload form?
| Thank you in advance
|
| ENT
|
| "Stefan B Rusynko" wrote:
|
| > Not with the std FP file upload component
| >
| > Check w/ your host to see if they support ASP and a File Upload component
| > You could do an ASP file upload and add ASP to delete all but .jpg files (after the upload)
| > - if the host supports a file use their script recommendation
| > Otherwise See http://support.microsoft.com/kb/299692/EN-US/
| >
| > Then modify the code for the UploadFile.asp to be
| >
| > If Err.number = 0 Then
| > For Each File in fuFile.Files
| > Ext = UCase(Right(fuFile.FileName, 3))
| > If Ext <> "JPG" Then
| > File.Delete
| > strMsg = "Illegal File NOT UpLoaded"
| > Else
| > strMsg = fuFile.FileName & " was uploaded successfully."
| > End If
| > Next
| > Else
| > .... .....
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Hi all,
| > | Is there any way it is possible to restrict the type of file uploaded using
| > | the file upload function within a form?
| > |
| > | I need to force users to upload files of one type i.e .jpg as uploading .bmp
| > | images is causing problems with the forum software I am using (apart from the
| > | obvious file size implications)
| > |
| > | Thanks for taking the time to read this posting. Andy
| >
| >
| >
 
Dear Stefan,

What do you mean "multiple File upload form elements"?
by adding more file type elements in the input form?
Of course I tried to one more file element in the form, and it did work any
more.
Did you try and succeeded??
Could you elaborate?
Thank you very much in advance
 
Yes meant adding
<input type="file" name="File1" size="20">
and
<input type="file" name="File2" size="20">

And set your permissions per
http://support.microsoft.com/default.aspx?scid=kb;en-us;299763&Product=fp2002

No haven't tried since I don't use the std FP forms
- I use ASPupload instead

--




| Dear Stefan,
|
| What do you mean "multiple File upload form elements"?
| by adding more file type elements in the input form?
| Of course I tried to one more file element in the form, and it did work any
| more.
| Did you try and succeeded??
| Could you elaborate?
| Thank you very much in advance
|
| "Stefan B Rusynko" wrote:
|
| > Try adding multiple File upload form elements
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Dear Stefan,
| > | How can I upload mutiple files in one upload form?
| > | Thank you in advance
| > |
| > | ENT
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Not with the std FP file upload component
| > | >
| > | > Check w/ your host to see if they support ASP and a File Upload component
| > | > You could do an ASP file upload and add ASP to delete all but .jpg files (after the upload)
| > | > - if the host supports a file use their script recommendation
| > | > Otherwise See http://support.microsoft.com/kb/299692/EN-US/
| > | >
| > | > Then modify the code for the UploadFile.asp to be
| > | >
| > | > If Err.number = 0 Then
| > | > For Each File in fuFile.Files
| > | > Ext = UCase(Right(fuFile.FileName, 3))
| > | > If Ext <> "JPG" Then
| > | > File.Delete
| > | > strMsg = "Illegal File NOT UpLoaded"
| > | > Else
| > | > strMsg = fuFile.FileName & " was uploaded successfully."
| > | > End If
| > | > Next
| > | > Else
| > | > .... .....
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > To find the best Newsgroup for FrontPage support see:
| > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > _____________________________________________
| > | >
| > | >
| > | > | Hi all,
| > | > | Is there any way it is possible to restrict the type of file uploaded using
| > | > | the file upload function within a form?
| > | > |
| > | > | I need to force users to upload files of one type i.e .jpg as uploading .bmp
| > | > | images is causing problems with the forum software I am using (apart from the
| > | > | obvious file size implications)
| > | > |
| > | > | Thanks for taking the time to read this posting. Andy
| > | >
| > | >
| > | >
| >
| >
| >
 
I use the ASPFileUpload to upload the file, which you posted before in this
thread:
http://support.microsoft.com/kb/299692/EN-US/

There is an example form for postfile.asp

ASP Code
1. Paste the following code to an editor, and then save it as PostFile.asp:
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<form enctype="multipart/form-data" action="/?scid=uploadfile.asp&fp=1"
method="post" name="main1">
<input name="file" type="file" size="50">
<INPUT type="text" id=text1 name=text1><INPUT type="text" id=text2 name=text2>
<input name="submit" type="submit" value="Upload">
</form>
</body>
</html>

It doesn't work when I change only the line under the "<FORM" statement:
<input name="file" type="file" size="50"> ,to
<input name="file1" type="file" size="50"> ,
I think the ASPFileUpload.dll recognise only the name="file", nothing else.
Let alone add one more file field to it.

Since my company doesn't have any budget for purchasing software, ASPupload
is not freeware, I can only use the ASP to fix it.
Thank you very much all the same.

Regards,
ENT








Stefan B Rusynko said:
Yes meant adding
<input type="file" name="File1" size="20">
and
<input type="file" name="File2" size="20">

And set your permissions per
http://support.microsoft.com/default.aspx?scid=kb;en-us;299763&Product=fp2002

No haven't tried since I don't use the std FP forms
- I use ASPupload instead

--




| Dear Stefan,
|
| What do you mean "multiple File upload form elements"?
| by adding more file type elements in the input form?
| Of course I tried to one more file element in the form, and it did work any
| more.
| Did you try and succeeded??
| Could you elaborate?
| Thank you very much in advance
|
| "Stefan B Rusynko" wrote:
|
| > Try adding multiple File upload form elements
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Dear Stefan,
| > | How can I upload mutiple files in one upload form?
| > | Thank you in advance
| > |
| > | ENT
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Not with the std FP file upload component
| > | >
| > | > Check w/ your host to see if they support ASP and a File Upload component
| > | > You could do an ASP file upload and add ASP to delete all but .jpg files (after the upload)
| > | > - if the host supports a file use their script recommendation
| > | > Otherwise See http://support.microsoft.com/kb/299692/EN-US/
| > | >
| > | > Then modify the code for the UploadFile.asp to be
| > | >
| > | > If Err.number = 0 Then
| > | > For Each File in fuFile.Files
| > | > Ext = UCase(Right(fuFile.FileName, 3))
| > | > If Ext <> "JPG" Then
| > | > File.Delete
| > | > strMsg = "Illegal File NOT UpLoaded"
| > | > Else
| > | > strMsg = fuFile.FileName & " was uploaded successfully."
| > | > End If
| > | > Next
| > | > Else
| > | > .... .....
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > To find the best Newsgroup for FrontPage support see:
| > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > _____________________________________________
| > | >
| > | >
| > | > | Hi all,
| > | > | Is there any way it is possible to restrict the type of file uploaded using
| > | > | the file upload function within a form?
| > | > |
| > | > | I need to force users to upload files of one type i.e .jpg as uploading .bmp
| > | > | images is causing problems with the forum software I am using (apart from the
| > | > | obvious file size implications)
| > | > |
| > | > | Thanks for taking the time to read this posting. Andy
| > | >
| > | >
| > | >
| >
| >
| >
 
It doesn't appear that code/application is design to allow more then one file to be uploaded at a
time, as it depends in this case if the .dll was written handle multiple file uploads at one time.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WebMaster Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================

ent said:
I use the ASPFileUpload to upload the file, which you posted before in this
thread:
http://support.microsoft.com/kb/299692/EN-US/

There is an example form for postfile.asp

ASP Code
1. Paste the following code to an editor, and then save it as PostFile.asp:
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<form enctype="multipart/form-data" action="/?scid=uploadfile.asp&fp=1"
method="post" name="main1">
<input name="file" type="file" size="50">
<INPUT type="text" id=text1 name=text1><INPUT type="text" id=text2 name=text2>
<input name="submit" type="submit" value="Upload">
</form>
</body>
</html>

It doesn't work when I change only the line under the "<FORM" statement:
<input name="file" type="file" size="50"> ,to
<input name="file1" type="file" size="50"> ,
I think the ASPFileUpload.dll recognise only the name="file", nothing else.
Let alone add one more file field to it.

Since my company doesn't have any budget for purchasing software, ASPupload
is not freeware, I can only use the ASP to fix it.
Thank you very much all the same.

Regards,
ENT








Stefan B Rusynko said:
Yes meant adding
<input type="file" name="File1" size="20">
and
<input type="file" name="File2" size="20">

And set your permissions per
http://support.microsoft.com/default.aspx?scid=kb;en-us;299763&Product=fp2002

No haven't tried since I don't use the std FP forms
- I use ASPupload instead

--




| Dear Stefan,
|
| What do you mean "multiple File upload form elements"?
| by adding more file type elements in the input form?
| Of course I tried to one more file element in the form, and it did work any
| more.
| Did you try and succeeded??
| Could you elaborate?
| Thank you very much in advance
|
| "Stefan B Rusynko" wrote:
|
| > Try adding multiple File upload form elements
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > _____________________________________________
| >
| >
| > | Dear Stefan,
| > | How can I upload mutiple files in one upload form?
| > | Thank you in advance
| > |
| > | ENT
| > |
| > | "Stefan B Rusynko" wrote:
| > |
| > | > Not with the std FP file upload component
| > | >
| > | > Check w/ your host to see if they support ASP and a File Upload component
| > | > You could do an ASP file upload and add ASP to delete all but .jpg files (after the
upload)
| > | > - if the host supports a file use their script recommendation
| > | > Otherwise See http://support.microsoft.com/kb/299692/EN-US/
| > | >
| > | > Then modify the code for the UploadFile.asp to be
| > | >
| > | > If Err.number = 0 Then
| > | > For Each File in fuFile.Files
| > | > Ext = UCase(Right(fuFile.FileName, 3))
| > | > If Ext <> "JPG" Then
| > | > File.Delete
| > | > strMsg = "Illegal File NOT UpLoaded"
| > | > Else
| > | > strMsg = fuFile.FileName & " was uploaded successfully."
| > | > End If
| > | > Next
| > | > Else
| > | > .... .....
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > To find the best Newsgroup for FrontPage support see:
| > | > http://www.net-sites.com/sitebuilder/newsgroups.asp
| > | > _____________________________________________
| > | >
| > | >
| > | > | Hi all,
| > | > | Is there any way it is possible to restrict the type of file uploaded using
| > | > | the file upload function within a form?
| > | > |
| > | > | I need to force users to upload files of one type i.e .jpg as uploading .bmp
| > | > | images is causing problems with the forum software I am using (apart from the
| > | > | obvious file size implications)
| > | > |
| > | > | Thanks for taking the time to read this posting. Andy
| > | >
| > | >
| > | >
| >
| >
| >
 
Back
Top