Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql and aspupload

Status
Not open for further replies.

jeellison

IS-IT--Management
May 29, 2002
78
GB
Hello Everyone,

Im using aspupload to upload files to a mysql database, but the code provided by aspupload if for sql. My question is does the code need to be changed for it to run with mysql?

Ive beenworking on if for days now and still cannot get it to work.

Here is what I have been given

<HTML>
<BODY>
<%
Set Upload = Server.CreateObject(&quot;Persits.Upload&quot;)
' Capture files
Upload.Savevirtual &quot;\uploads&quot;

' Obtain file object
Set File = Upload.Files(&quot;THEFILE&quot;)

If Not File Is Nothing Then
' Build ODBC connection string
Connect = &quot;Driver={Microsoft Access Driver (*.mdb)};DBQ=&quot; & Server.MapPath(&quot;.\aspupload.mdb&quot;)

' If you use SQL Server, the connecton string must look as follows:
' Connect = &quot;Driver=SQL Server;Server=MYSERVER;UID=sa;PWD=xxxxxxxxx&quot;

' Build SQL INSERT statement
SQL = &quot;INSERT INTO MYIMAGES(image_blob, filename, description, filesize) VALUES(?, '&quot;
SQL = SQL & File.Filename & &quot;', '&quot;
SQL = SQL & Replace(Upload.Form(&quot;DESCR&quot;), &quot;'&quot;, &quot;''&quot;) & &quot;', &quot;
SQL = SQL & File.Size & &quot;)&quot;

' Save to database
File.ToDatabase Connect, SQL
Response.Write &quot;File saved.&quot;
Else
Response.Write &quot;File not selected.&quot;
End If
%>
</BODY>
</HTML>

Any help on this would be greatly appreciated or if anyone has it working with mysql could you possible provide me with the right code, as I have ben trying to get it work for days now.

Best Regards
James

 
1) Comment the connection string related to msaccess

Uncomment and change the code where it says


<%
Connect = &quot;Driver=SQL Server;Server=MYSERVER;UID=sa;PWD=xxxxxxxxx&quot;
%>


CHANGE TO


<%
Set Connect = Server.CreateObject(&quot;ADODB.Connection&quot;)
Connect.Open (&quot;Driver={MySQL}; SERVER=ip_address; DATABASE=DBname; UID=valid_user; PASSWORD=xxxxx&quot;)
%>


Bye


Qatqat

Life is what happens when you are making other plans.
 
Thank you very much for your feedback Qatqat. But now I get this error message:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/odbc_upload.asp, line 31

on this line: Connect.Open (&quot;Driver={MySQL}; SERVER=ip_address; DATABASE=DBname; UID=valid_user; PASSWORD=xxxxx&quot;)

I have changed all the field to the correct ones. Any ideas?

Kindest Regards
James

 
Try connecting with a DSN


If you create a DSN called myDSN, your connection string will be


<%
Set Connection = Server.CreateObject(&quot;ADODB.Connection&quot;)
Connection.Open &quot;myDSN&quot; , &quot;valid_user&quot;, &quot;password&quot;
%>


Bye


Qatqat

Life is what happens when you are making other plans.
 
Sorry to be such a pain Qatqat, but still getting this error: Persits.Upload.1 error '800a0018'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/odbc_upload.asp, line 48


on this line now: File.ToDatabase Connect, SQL

Anymore advice?

Kind Regards
James
 
I have never personally use ASPupload.

Perhaps there is a compatibility problem with the dll shipped with Aspupload and anything that is not microsoft.


I will search for info around



Bye


Qatqat

Life is what happens when you are making other plans.
 
Sorry to trouble you again Qatqat but will this line work to save the database:

File.ToDatabase Connect, SQL

Or does it need to be something else considering it is mysql? This is the line it keeps throwing the error on.

Kind Regards
James
 
OK, think i have the connection string sorted but now but am getting this error:

Persits.Upload.1 error '800a0018'

[TCX][MyODBC]Can't connect to MySQL server on 'localhost' (10061)

/odbc_upload.asp, line 49

any ideas why it is checking local host??

Thanks in advance to anyone :)

James.


 
FANTASTIC - I GOT IT WORKING.

tHANKS FOR YOUR HELP AGAIN.

 
Cool, I am happy for you.

Anyway, it is good practice in this forum to post the solution after you have found it or explain what you have done to solve your problems. May other people may be interested to it including myself (I confess I have looked at ASPupload myself after your post)


Bye


Qatqat

Life is what happens when you are making other plans.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top