
04/11/2007, 06:59
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 106
Antigüedad: 17 años, 7 meses Puntos: 0 | |
otro codigo con problemas hola lo siento pero este ultimo tiempo he tenido muchos problemas con los codigos aqui tengo otro problema...
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][Administrador de controladores ODBC] No se encuentra el nombre del origen de datos y no se especificó ningún controlador predeterminado
/aspupload/photo_upload_post.asp, línea 9
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ConUpload.asp" -->
<%
'Just change the connection string "MM_ConAlbum_STRING" to yours incase you want to integrate
' it in your website. If want to use as standalone, leave it as it is
set rsUpload = Server.CreateObject("ADODB.Recordset")
rsUpload.ActiveConnection = MM_ConUpload_STRING
rsUpload.Source = "SELECT * FROM album"
rsUpload.CursorType = 0
rsUpload.CursorLocation = 2
rsUpload.LockType = 3
rsUpload.Open()
rsUpload_numRows = 0
%>
<%
Set Upload = Server.CreateObject("Persits.Upload")
'to show the progress bar uncomment the line below
'Upload.ProgressID = Request.QueryString("PID")
'Assign unique name if filename already exists. If you want to overite just set ti to True
Upload.OverwriteFiles = False
'For physical path e.g.
'Upload.Save "C:\Inetpub\wwwroot\aspupload\images\"
'virtual path
Upload.Save Server.MapPath("images")
' Here we are assigning variables, value from form submitted on previous page
Set File = Upload.Files("file")
'assigning the real name of the file uploaded to variable fn
fn = File.ExtractFileName
'assigning the path where the file is uploaded to variable fnPath
fnPath = File.Path
' We are resizing the image twice so for each time we will save them as different filename
' e.g. if you upload a PIC named 1.jpg, variable fnThumb and fnResized will be assigned the
' values small_1.jpg and resized_1.jpg
'
fnThumb = "small_" & fn
fnResized = "resized_" & fn
' Set an instant of Aspjpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
'This will automatically open the PIC uploaded in the memory
Jpeg.Open File.Path
'prints the copy right sign on the pic, you can change &HFF0000 to &H000000 in order to print in black
'if you don't want to just comment the line 63, 64, 65 and 67
Jpeg.Canvas.Font.Color = &HFF0000' red
Jpeg.Canvas.Font.Family = "Courier New"
Jpeg.Canvas.Font.Bold = True
'below 10 is the size of Font and 350 is the position of the text to be printed from top
Jpeg.Canvas.Print 10, 350, " (c) Copy right MXMANIA"
'here we resize the photo for preview to save a little bandwidth
Jpeg.Width = 300
Jpeg.Height = 200
Jpeg.Sharpen 1, 150
' save it to Physical path e.g.
'Jpeg.Save "C:\Inetpub\wwwroot\aspupload\images\resized_" & File.FileName
'save it to Virtual path
Jpeg.Save Server.MapPath("images\resized_") & File.FileName
'Uncomment line 82 to 91 if you want to serverside validation of the image height and width
'session("height") = jpeg.OriginalHeight
'session("width") = jpeg.OriginalWidth
'if jpeg.OriginalWidth > 650 then
'response.redirect("error.asp")
'end if
'session("height") = jpeg.OriginalHeight
'if jpeg.OriginalHeight > 600 then
'response.redirect("error.asp")
'end if
'set the height and width of thumbnails.You can change the value 120 to whatever you wish
'you can also do it other way round by setting jpeg.Width = 120 and jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
'or you can decrease the size in percents e.g. J
'peg.Width = Jpeg.OriginalWidth / 2
'Jpeg.Height = Jpeg.OriginalHeight / 2
'Jpeg.Height = 120
'jpeg.Width = jpeg.OriginalWidth * jpeg.Height / jpeg.OriginalHeight
' uncomment line 84 and 85 if you want to resize inaccordance with the width
Jpeg.Width = 107
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
'Apply sharpening if necessary, this argument must be greater than 100
Jpeg.Sharpen 1, 150
' create thumbnail and save it to disk
'Physical path
'Jpeg.Save "C:\Inetpub\wwwroot\aspupload\images\small_" & File.FileName
'virtual path
Jpeg.Save Server.MapPath("images\small_") & File.FileName
%>
<%
'now we will assign all teh form variables from previous page to some variables in order
'to enter them in database. As we are using the "aspupload" component, we have to use
'Upload.Form insteaad of Request.Form.
set pTitle=Upload.Form("title")
set pDescr=Upload.Form("DESCR")
set pHeight= Upload.Form("height")
set pWidth= Upload.Form("width")
'check if picture to be uploaded is private or public
'if(Upload.Form("radio") <> "") then
'set pPrivate= Upload.Form("radio")
'end if
'updating the database
rsUpload.addnew
rsUpload("pic_original")= fn
rsUpload("path")= fnPath
rsUpload("pic_thumb")= fnThumb
rsUpload("pic")= fnResized
rsUpload("Title")=pTitle
rsUpload("Detail")=pDescr
rsUpload("height")=pHeight
rsUpload("width")=pWidth
'if(Upload.Form("radio") <> "") then
'rsUpload("private_pic")= pPrivate
'end if
rsUpload.update
' thats it. if you want to add more form infos indatabase create as many variables
'you want to in the same manner as above.
'e.g. if you have added another form field "user" on the "Photo_upload.asp (in our case)"
'then first assign it to some variable say set pUser=Upload.Form("user") and then after the
'line "rsUpload.addnew" add rsUpload("user")=pUser where User in "rsUpload("user")" is the new field in
' in your database
'
'For more info visit http://www.aspjpeg.com/aspjpeg.html
%>
<%
rsUpload.Close()
response.redirect "upload_succes.asp"
%> |