Classic ASP & Jquery uploader

Softacid
Softacid used Ask the Experts™
on
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 ..
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010

Commented:
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
Top Expert 2010

Commented:
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();
}

Author

Commented:
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
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Author

Commented:
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 ..
Top Expert 2010

Commented:
Im working on it. Will make a solution for You.
Top Expert 2010
Commented:
Here You go. I created form.asp and uploader.asp to help You understand this.
1. Copy them to folder where You have form.html (that html file is not needed for this since you have asp one).
2. Also copy image cancel.png to the folder scripts.
3. Make folder named upload in the root of Your site. Notice that Im setting the folder to upload files to in file uploader.asp.

Just to check, You should have these files in Your scripts folder:

uploader.asp
uploader.cls
jquery.uploadify.v2.1.0.min.js
jquery-1.3.2.min.js
swfobject.js
cancel.png
expressInstall.swf
uploadify.swf
uploadify.allglyphs.swf

form.asp should be in the root of Your site.

If You have any further questions, I would be glad to help, since I know how this was frsutrating to me till I solved it.

Regards
Bosko
form.asp.txt
uploader.asp.txt
cancel.png

Author

Commented:
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

Author

Commented:
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?
Top Expert 2010

Commented:
Working on it right now. :)
Top Expert 2010

Commented:
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.

Author

Commented:
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 .
Top Expert 2010

Commented:
You welcome.

Commented:
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?
Top Expert 2010

Commented:
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.

Author

Commented:
Zybeo:check your forlder permission on server .. i mean th eupload folder permission is wrong that's why you get the problem .

Commented:
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?

Commented:
Never mind...I figured it out.  Thanks for the scripts!
Top Expert 2010

Commented:
Good job, sorry for not being here earlier.

Author

Commented:
happy i could help you

Commented:
Hello Very good solution to the uploadfy. I need to write the name of the attached file to the database. How can I do?
Top Expert 2010

Commented:
You have it a couple of posts below the accpeted solution. :)

Regards

Commented:
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)
Top Expert 2010

Commented:
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

Commented:
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
Top Expert 2010

Commented:
Im glad you sorted it out pretty much on your own.

Regards

Commented:
how should I proceed to resize images after upload with AspJpeg?
Top Expert 2010

Commented:
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

Commented:
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)      
%>
Top Expert 2010

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial