Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 non-url download link?
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 12 January 2005 :  16:45:21  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
davio: nice, you don't happen to have a little dbs-file for creation of the db-tables? ;) Or can you tell me which tables and what settings I should use?

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 12 January 2005 :  17:08:05  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
If you have the ASPUpload component on your server you could do something like this:

Set Upload = Server.CreateObject("Persits.Upload")
Upload.SendBinary "c:\path\to\your\file.zip, True, "application/octet-stream", True

My download file looks like this:


	Dim Upload, fileId, strsql
	Dim fileName, dlCount
	if not(trim(request.querystring("id"))) = "" then
	  fileId = Cint(request.querystring("id"))
	else
	  fileId = 0
	end if
	
	if fileId <> 0 then
	Dim dConn, dConnString
	  dConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=xxxxxxxxxxxx\kdownload.mdb"
	  Set dConn = Server.CreateObject("Adodb.Connection")
	  dConn.open dConnString
	  
	  strsql = "SELECT DOWNLOADS.D_FILENAME, DOWNLOADS.D_DOWNLOADS FROM DOWNLOADS WHERE DOWNLOADS.D_ID=" & fileId & ";"
	  'response.write(strsql)
	  set rs = server.createobject("adodb.recordset")
	  rs.open strsql, dConn
	    fileName = rs("D_FILENAME")
	    dlCount = Cint(rs("D_DOWNLOADS"))+1
	  rs.close
	  set rs = nothing
	  strsql = "UPDATE DOWNLOADS SET D_DOWNLOADS=" & dlCount & " WHERE D_ID=" & fileId
	  dConn.execute(strsql)
	  
	 Set Upload = Server.CreateObject("Persits.Upload")
	 Upload.SendBinary "xxxxxxxxxxxxxxxxxxxx" & "\" & fileName, True, "application/octet-stream", True
	end if

-Stim

Edited by - Da_Stimulator on 12 January 2005 17:10:05
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 12 January 2005 :  18:26:16  Show Profile
quote:
Originally posted by tribaliztic

davio: nice, you don't happen to have a little dbs-file for creation of the db-tables? ;) Or can you tell me which tables and what settings I should use?


I just have a table called "MOD_NAME" (I know, not exactly the best title) which I'm sure you can find a better name for, with the following fields.

FILE_ID PRIMARY_KEY, tinyint(3), NOT NULL, Default 0
FILE_TITLE varchar(50), NOT NULL
FILE_PATH varchar(50), NOT NULL

Also had "MOD_INFO" (again, not exactly the best title) which I stored the # of downloads.

ID Primary Key, int(11), NOT NULL, auto_increment
FILE_ID tinyint(3), NOT NULL, Default 0
DOWNLOADS int(11), NOT NULL, Default 0
DOWNLOAD_DATE varchar(8), NOT NULL

My database setup is not the best. Rui gave me a recommendation on a new database table, to help me track each download. So I will most likely do away with this.
But you can take and moodify as you wish. Just change the names in the asp file.

Support Snitz Forums
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 13 January 2005 :  04:51:55  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Davio: Will have a look at this. Are you saying that you're going to work further on this code?

DaStimulator: I've never worked with that component so I don't understand your code =) I'll check if I have the component installed and maybe you can explain it alittle more? What you are saying is that the link on my site is c:\files\file.zip and not http://www.url.com/files/file.zip? In that case it should be impossible to use the link anywhere else I suppose?

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 13 January 2005 :  06:34:51  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
DaStimulator: How does you db-tables look?

Sorry for being such a pain in the A** folks ;)

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 13 January 2005 :  11:37:49  Show Profile
quote:
Davio: Will have a look at this. Are you saying that you're going to work further on this code?
Maybe. I'm not sure. I'm working on setting up a php portal on my site, which has a download feature. So I might just use that instead. If it doesn't work out, I'll continue to work on it. I had started to build a front-end for it, but couldn't complete it until I settled down with the database fields I wanted.

Support Snitz Forums
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 13 January 2005 :  15:50:12  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Ouch!! PHP? Is that some kind of disease? =)
Well, I'll give this a try and see how far I get..

But DaStimulator have a nice feature there.. I've installed aspupload now..

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 13 January 2005 :  19:13:28  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
My db is setup loke so:

Table: DOWNLOADS
D_ID AutoNumber
D_FILENAME Filename of the file, text, 100
D_TITLE Text, holds the name of the download
D_CAT Number, holds cat ID (optional)
D_URL holds url to webpage explaining download (option, I use it to dynamically list my downloads...)
D_DOWNLOADS number, holdi8ng the number of times a file's been downloaded

-Stim

Edited by - Da_Stimulator on 13 January 2005 19:14:25
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 14 January 2005 :  02:31:35  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Thanks alot, will try and make something out of this!

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 14 January 2005 :  05:54:05  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
I use MySQL and created this table:
D_ID int(11) Nej auto_increment
D_FILENAME varchar(150) Nej
D_TITLE varchar(150) Nej
D_CAT int(11) Nej 0
D_URL varchar(250) Nej
D_DOWNLOADS int(11) Nej 0

I hope this will work as I don't know what I'm doing hehehe..
Have to test alittle more..

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 14 January 2005 :  10:49:10  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
GAH! Can't make it work! I've tried everything.. =)

Here's my code, can someone pleeease help me?
http://gotlandrace.no-ip.com/forum/aspuploadtest.txt

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 15 January 2005 :  11:37:20  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
I'm ready to give up.. Soon I've terrorized about my friends about this one and noone can make it work.. Anyone? pretty please? =)

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 15 January 2005 :  12:43:47  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
WOHO! Got it working..
But the file is displayed instead of sent to the server. Also I tried with a zip-file and got som sort of "permission denied" error.

How can I enable different files, and how can I make the files begin to download with a progress bar instead of displayed?


/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 15 January 2005 :  13:34:07  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
what do you mean the file is displayed? you get wierd characters displayed?

if thats the case you need to change the content-type header output.

Also you need to include the +1 after dlCount = rs("D_DOWNLOADS")+1

make sure the path to your file is absolute and correct.

-Stim

Edited by - Da_Stimulator on 15 January 2005 13:37:40
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 15 January 2005 :  15:58:02  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
The txt-file isn't updated with the working file.
Yes, strange characters. Txt-files and image files are displayed alright though.
content-type header? This you mean: "application/octet-stream"?
I found the aspupload manual, I think I'll have to read alittle..

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.44 seconds. Powered By: Snitz Forums 2000 Version 3.4.07