Link to home
Start Free TrialLog in
Avatar of Softacid
Softacid

asked on

Classic ASP & Jquery uploader

Hello does anybody know any Classic ASP & Jquery integration uploader .. the most code i found are in PHP and i don't know how to rewrite them in classic ASP
i liked uploadify.com for example ..
Avatar of R-Byter
R-Byter
Flag of Serbia image

Its Your lucky day.
I used one recently, uploadify to be exact in combination with ASP.

Here are the lines of interest from document.ready section (I used some querystring parameters to distinguish the folder where my file needs to be uploaded):

'uploader'       : 'uploadify.swf',
'script'            : 'uploader.asp?i=<%=i%>'+escape("&")+'sekcija=funkcije',

And I'll attach uploader.cls and my uploader.asp file which is used to upload and save file to specific path. (Remove txt extension at the end of both files since EE doesnt allow asp or cls as attachments)
If You have any further questions, do not hesitate to ask.

Regards
Bosko

uploader.cls.txt
uploader.asp.txt
And of course html and javascript code:

<p class="legend">Files</p>
<p id="slanje" name="slanje"><a href="javascript:Send_document()"><b>Save file</b></a></p>
<p><input class="text-input" name="uploadify" id="uploadify" type="file" size="20"></p>

function Send_document()
{
      $('#uploadify').uploadifyUpload();
}
Avatar of Softacid
Softacid

ASKER

Thank you for your answer .. i tried to adpt the script you sent me to my needs but no luck yet :(
Please take a look at :http://bookingscripts.com/lasthrs/upload/form.html
I'm not sure where i mistake ,

thank you
Also in your ASP code seems that is uploading in 2 different folders or create a new folder?
Just need to upload one foto to one specified folder ..
Im working on it. Will make a solution for You.
ASKER CERTIFIED SOLUTION
Avatar of R-Byter
R-Byter
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you thank yo so much is working :)  now
I will give you right now the points .. still there is one last easy thing to find and if you know it you'll save me time .. i will want to add in the database the name of the file uploaded .. you know in what file is the name of file uploaded or where exactly i could add the Insert into ?

Thank you so much this is great
I mean i think i could get the file name from request.form("text-input") and then to make some split replaces .. bla bla but i think there's a simpler way inside the script already to find the just uploaded file name right?
Working on it right now. :)
Find this line in form.asp:

$('#filesUploaded').append('<div class=\'uploadifyQueueItem\'><a href='+path+' target=\'_blank\'>'+fileObj.name+'</a></div>');

Add this one below:

location = "savefile.asp?name="+fileObj.name;

Where You can make database manipulation in savefile.asp.
Be sure to protect this savefile.asp page so noone can insert data into database except You.
With slightly modified lines it could be configured to send filename with POST request instead of GET which is more secure.

Regards
Bosko.
Thank you very much ,

the whole upload thing will be under administration area so will be the check if loggedin all the pages on top so only someone logged in could manipulate the file .. or else will be redirected to the login form .
You welcome.
R-Byter:  I've tried both of your uploader.asp files but get an error message after the file appears to hit 100%.  The error pops up and says "error aaaHTTP: undefined"  .

It appears as though this error is called in form.asp when d.type === "HTTP"  

Is there something I need to change to get this to work?
Could You post Your files here so I can have precise info on what You did so far?
It could be some minor typo at Your code.
Zybeo:check your forlder permission on server .. i mean th eupload folder permission is wrong that's why you get the problem .
Thanks!  It appears as though it was indeed a folder permission.   It works now, but I'd like to add something to the querystring of uploader.asp.  

where it says
'script'         : 'scripts/uploader.asp',

I'd like to make it something like

'script'         : 'scripts/uploader.asp?customer_id=' + customer_id,  

Do I have my javascript wrong?

Never mind...I figured it out.  Thanks for the scripts!
Good job, sorry for not being here earlier.
happy i could help you
Hello Very good solution to the uploadfy. I need to write the name of the attached file to the database. How can I do?
You have it a couple of posts below the accpeted solution. :)

Regards
Hello, I need to write the name of each image in the database. where I
insert the SQL command? In which file?

<!--#include file="../../conexao.asp" -->
dim conexao, xsqlin, varimg
.
.
.
.
xsqlin = "Insert Into album (img) Values ('"&varimg&"')"
Conexao.Execute(xsqlin)
I already wrote :)

Find this line in form.asp:

$('#filesUploaded').append('<div class=\'uploadifyQueueItem\'><a href='+path+' target=\'_blank\'>'+fileObj.name+'</a></div>');

Add this one below:

location = "savefile.asp?name="+fileObj.name;

Where You can make database manipulation in savefile.asp.

You need to put SQL command the image into savefile.asp in this case and you can get filename by Request.QueryString

Regards
I managed to solve the following solution:

Form.asp:
'script'  : 'upload/uploader.asp?pastaimg=<%=pastaimg%>'+escape("&")+'idgaleria=<%=idgaleria%>'+escape("&")+'tipogaleria=<%=tipogaleria%>',

uploader.asp:

idgaleria = cint(request.QueryString("idgaleria"))
pastaimg = request.QueryString("pastaimg")
tipogaleria = cint(request.QueryString("tipogaleria"))

uploader.cls

    Do Until Flag = True
        If objFSO.FileExists(NewFullPath) = False Then
            Flag = True
            GetFileName = NewFullPath 'Mid(NewFullPath, InstrRev(NewFullPath, "\") + 1)
----->    xsqlin = "Insert Into album (idgaleria, tipo, img) Values ('"&cint(idgaleria)&"', '"&cint(tipogaleria)&"', '"&nameimg&"')"
----->    Conexao.Execute(xsqlin)
        Else
            Counter = Counter + 1
            NewFullPath = strSaveToPath & "\" & strTempFileName & Counter & "." & FileExt
        End If      
    Loop
End Functio
Im glad you sorted it out pretty much on your own.

Regards
how should I proceed to resize images after upload with AspJpeg?
You should ask that as another question (a related one) and Im sure someone will give you an answer on that. I would if I know how to do it, but since I dont use AspJpeg, you'll get better chance of getting an answer if you ask it as a separate question.

Regards
The solution presented in ID: 35735944 only works for sending a file
via uploadify. When sending more than one file, the function performs only one
time.

-----------------------------------------------------------------------
$('#filesUploaded').append('<div class=\'uploadifyQueueItem\'><a href='+path+' target=\'_blank\'>'+fileObj.name+'</a></div>');

Add this one below:

location = "savefile.asp?name="+fileObj.name;
-----------------------------------------------------------------------
Contents of the savefile.asp:
<!-- #include file="../conexao.asp" -->
<%
dim conexao, driver, xsqlin, name
Abrearq()

name = request.querystring("name")

xsqlin = "Insert Into album (img) Values ('"&name&"')"
Conexao.Execute(xsqlin)      
%>
Do you have multi property of the uploadify set to true?
Once again, I think its better for you to ask this as a separate question since it'll bring you more attention. This question is flagged as closed, points already awarded and few people will even look at it.

Regards