Author |
Topic |
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 12 January 2005 : 16:45:21
|
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 -
|
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 12 January 2005 : 17:08:05
|
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 |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 12 January 2005 : 18:26:16
|
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
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 13 January 2005 : 04:51:55
|
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 -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 13 January 2005 : 06:34:51
|
DaStimulator: How does you db-tables look?
Sorry for being such a pain in the A** folks ;)
|
/Tribaliztic - www.gotlandrace.se -
|
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 13 January 2005 : 11:37:49
|
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
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 13 January 2005 : 15:50:12
|
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 -
|
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 13 January 2005 : 19:13:28
|
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 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 14 January 2005 : 02:31:35
|
Thanks alot, will try and make something out of this!
|
/Tribaliztic - www.gotlandrace.se -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 14 January 2005 : 05:54:05
|
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 -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 15 January 2005 : 11:37:20
|
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 -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 15 January 2005 : 12:43:47
|
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 -
|
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 15 January 2005 : 13:34:07
|
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 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 15 January 2005 : 15:58:02
|
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 -
|
|
|
Topic |
|