upload many files to DataBase (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


wizard_oz -> upload many files to DataBase (7/23/2005 9:11:10)

hi, I would like to upload some files to the server (asp) and insert them to my database, does anyone can help me with that?
Elen




Eli -> RE: upload many files to DataBase (7/23/2005 12:48:46)

you mean you want to upload files and insert the locations of the files into the database?

Try this: http://www.freeaspupload.net/




wizard_oz -> RE: upload many files to DataBase (7/23/2005 13:12:40)

I would like to upload some files the a specific directory , that mean that I want to be able to choose the directory and upload files to that directory. But I want to use a code to not a software that someone wrote




rdouglass -> RE: upload many files to DataBase (7/23/2005 15:00:22)

I have code that will upload multiple files from the same form but it doesn't allow the user to choose the directory. You probably could do that but the difficulty lies in ensuring the user has proper priviledges for that directory.

There also is some risk in showing the user the names and paths of the directories that have upload priv's. That can increase the risk of malicious upload. Forcing the directory doesn't negate that risk, just decrease it.

It is based on the scripts here:

http://www.asp101.com/articles/jacob/scriptupload.asp

Hope it helps.




wizard_oz -> RE: upload many files to DataBase (7/24/2005 5:01:31)

Is there another way to upload multiple files? any ideas?




rdouglass -> RE: upload many files to DataBase (7/25/2005 11:16:58)

quote:

Is there another way to upload multiple files? any ideas?


Can you be very specific as to what you want to do and what it would look like?




wizard_oz -> RE: upload many files to DataBase (7/27/2005 15:42:23)

I would like to create a folder (this i did with objFSO) and my problem is to upload some files to that directory
How do I do it? I can upload 1 file to a cerain directory like spooki gave at the start of this page but I it's not good enough
please help me




rdouglass -> RE: upload many files to DataBase (7/27/2005 16:01:00)

quote:

I would like to create a folder (this i did with objFSO) and my problem is to upload some files to that directory


The problem with doing it this way is that you have to be sure the created folder has the proper permissions for the IUSR_machinename account.

Did you look at the link I posted? I use a version of that to upload 4 files at a time and I can make it do as many as I want. It *does* do what you want it to do; please take a few minutes and look at this before you post again.

Part of the problem with this is that you *will* have to do *some* work. Everything posted here is generally examples and not "plug and play" code. We will help you a lot but it usually requires some effort from you too.

Please don't take that wrong; it's just that all your answers are right here in this post. Really, they are. [;)]




wizard_oz -> RE: upload many files to DataBase (7/31/2005 4:15:32)

Still can't do it. I created a folder with the person name and I would like to upload a file to that directory, I don't know how to choose that directory, I can choose the name from a combo box but how am I trnasfer it to the uplaod.asp code , I need help about it





wizard_oz -> RE: upload many files to DataBase (8/3/2005 4:08:35)

anyone???????????




rdouglass -> RE: upload many files to DataBase (8/3/2005 11:35:16)

What code are you currently using for uploading your files?




wizard_oz -> RE: upload many files to DataBase (8/3/2005 14:51:55)

I am using the code that spooky gave upload.zip and the code look like
<!--#include file="code/clsupload.asp"-->
<%
'#===========================
'# Allowable file extensions
'#===========================

sAllowedFiles 	= "zip,jpg,gif"

'#===========================
'# Upload size max in bytes
'#===========================

iUplSize 	= 200000

'#===========================
'# File path (based on the root of your web)
'#===========================

sUploadPath	= "/uploads"

'#===========================
'# Name of the text box that the
'# file name will be saved to.
'#===========================

TextBox		= "Upload"

Set Upload 	= New clsUpload
FileName 	= Upload.Fields("FileName").FileName
Ext 		= Upload("FileName").FileExt
	if inStr(uCase(sAllowedFiles),uCase(Ext)) > 0 then
		If Upload("FileName").Length <= iUplSize then
			Folder = Server.MapPath(sUploadPath)  & "\"
			FileName = Upload.UniqueName(Folder, FileName)
			Upload("FileName").SaveAs Folder & FileName
		Else
			errmessage = "File must be less than "& iUplSize/1000 & " kb"
		End if
	else
		errmessage = "File type not supported."
	end if
Set Upload = Nothing
%>
	<HTML>
	<HEAD>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function copyForm() {
	    opener.document.Upload.<%=TextBox%>.value = document.popupForm.FileName.value;
	    document.popupForm.submit();
	    window.close();
	    return false;
	}
	//-->
	</SCRIPT>
	</HEAD>
	<%If len(errmessage) > 0 then%>
	<BODY>
	<%=errmessage%>
	<%Else%>
	<BODY onLoad="return copyForm()">
	<FORM NAME="popupForm" onSubmit="return copyForm()">
	<INPUT TYPE="TEXT" NAME="FileName" value="<%=FileName%>">
	<INPUT TYPE="BUTTON" VALUE="Submit" onClick="copyForm()">
	</FORM>
	<%end if%>
	</BODY>
	</HTML>




rdouglass -> RE: upload many files to DataBase (8/3/2005 16:34:36)

quote:

'#===========================
'# File path (based on the root of your web)
'#===========================

sUploadPath = "/uploads"


That's where it's done. You'd need to change that to grab the dropdown selection and place it in the script for the variable "sUploadPath" and of course, ensure the folder is writeable.




wizard_oz -> RE: upload many files to DataBase (8/4/2005 7:52:49)

I know that what I need to do and that's the exact problem because the path is constant and my question is how to make it as a drop down list or I need to get the path from another ASP file (something like request.form)




Spooky -> RE: upload many files to DataBase (8/4/2005 15:52:59)

To provide a variable path, youll need to send the value from the drop down
Use simple values in the drop down (eg 1,2,3).

sPath = Upload.Fields("Path").FileName
If sPath = "1" then
sUploadPath	= "/uploads1"
elseif sPath = "2" then
sUploadPath	= "/uploads2"
else
sUploadPath	= "/uploads"
end if




wizard_oz -> RE: upload many files to DataBase (8/4/2005 17:24:42)

thanks for your support but this is not what i was looking for.
I create a form and when then client fill the form, it create a folder with the person name so he can upload as many picture as he wants, so you see I don't know the folders name. i can send the person name (the same as the folder name) to another ASP page, can I use your code and choose another folder from a diffrent ASP file? (like a request.form)?




Spooky -> RE: upload many files to DataBase (8/4/2005 17:36:25)

so your path would equal :
sUploadPath = "/username" ?

Would this work for you (assuming they have a session)?
sUploadPath = "/"&Session("username")




wizard_oz -> RE: upload many files to DataBase (8/4/2005 17:41:18)

no I am not using with session becasue only 1 person is uploading the pictures but he upload a diffrent person everytime




Spooky -> RE: upload many files to DataBase (8/4/2005 18:18:30)

So - he needs to select the persons name (and thus the directory?)

If thats the case - then shouldnt the drop down list contain the names of all the users?




wizard_oz -> RE: upload many files to DataBase (8/4/2005 18:38:15)

yes that's what I need




Spooky -> RE: upload many files to DataBase (8/4/2005 18:59:28)

So, youd do as per my instructions above, but use the username.
You can extract those values from a database or hard code them.
Id do the later while I was testing.




wizard_oz -> RE: upload many files to DataBase (8/4/2005 19:05:39)

Sorry I didn't get your point. How do I send to your upload.asp the name? and how do I use the path with the name I got ?




Spooky -> RE: upload many files to DataBase (8/5/2005 0:04:19)

In your first form you may have :

<select name="Username">
<option>Name1</option>
<option>Name2</option>
<option>Name3</option>
</select>

Then, in the upload page :
sUploadPath = Upload.Fields("Username").FileName




wizard_oz -> RE: upload many files to DataBase (8/5/2005 7:03:33)

at your example (upload.zip) am I doing it at the file upload.asp or upload_demo.htm? (this is my first time using these application)




Spooky -> RE: upload many files to DataBase (8/5/2005 16:08:27)

You enter the file and directory name in upload.asp and the path changes in the processing page




wizard_oz -> RE: upload many files to DataBase (8/7/2005 17:58:55)

Thanks I'll try it.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.09375