|
Prev: How to access asp controls inside a loginview
Next: Createing new ASP.Net application using VB and VS2005
From: SEMIH DEMIR on 15 Feb 2006 04:25 Sitelerden birinde verilen yabancý kaynakli bir scriptti duzenledim yanlýz birseyin içinden bir turlu cýkamadým iþin aslý ilk defa persistin upload componentini kullanacam yanlýz suanki haliyle verdiði hata þu.Bilen arkadaþlar lütfen yardým edin Persits.Upload.1 error '800a0020' The system cannot find the path specified. /classifieds/upload.asp, line 250 sistem dosya yolunu bulamadý. 2 dosyam var Birinde baglantýlarýn yolunu belirleyen inc_conn.asp ve upload.asp inc_conn.asp ' nin içeriði <!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common Files\System\ado\msado15.dll" --> <% '========================================== 'CONFIGURATIONS '========================================== 'DATABASE 'enter 1=DEFAULT SETTING (DATABASE IN db/ folder) 'enter 2=DATABASE IS OUTSIDE CLASSIFIED ADS db/ FOLDER (THEN EDIT THE DATABASE PATH BELOW) 'enter 3=DSN 'enter 4=SQL SERVER strDatabaseFile = 1 'IF ABOVE YOU ENTERED 2 'DEFINE DATABASE PATH (ie c:\inetpub\wwwroot\classifieds\db) 'If you don't intend to use the default path 'Contact your host if you don't know it 'IMPORTANT---FOLDER MUST HAVE A WRITE PERMISSION (CONTACT YOUR HOST FOR INFO) 'remove the ' in the beginning of the line to activate 'strDatabasePath = "d:\webspace\resadmin\bogazicikonut\bogazicikonut.com.tr\www\classifieds\" 'THE ABSOLUTE PATH TO YOUR CLASSIFIED ADS FOLDER 'Change the Classifieds to directory name if you use another name strAbsolutePath= "d:\webspace\resadmin\bogazicikonut\bogazicikonut.com.tr\www\classifieds\" 'SITE NAME strSiteName = "bogazicikonut.com.tr!" 'DOMAIN EMAIL where user can contact you (Used only in the footer of every pages) strInfoEmail = "webmaster(a)bogazicikonut.com.tr" 'UPLOAD----------------------------- 'PHOTO UPLOAD 1=YES 0=NO UploadOption = 1 'IF UPLOAD = 1 THEN SPECIFY FOLDER (if you use the default folders, there is no need to edit) '---FOLDER MUST HAVE A WRITE PERMISSION (CONTACT YOUR HOST FOR INFO) strUploadFolder = "d:\webspace\resadmin\bogazicikonut\bogazicikonut.com.tr\www\classifieds\uploads" strAbsUploadPath = strCatUploadFolder 'IMAGES FOR CATEGORY 1=YES 0=NO ---WILL APPEAR FOR POSTED ADS ON MAIN PAGE--- strCategoryImage = 1 strCatUploadFolder = "d:\webspace\resadmin\bogazicikonut\bogazicikonut.com.tr\www\classifieds\uploads" strAbsCatUploadPath = strCatUploadFolder 'EMAIL---------------------------- 'EMAIL OPTION 1=YES 0=NO ---ONLY IF YOUR SITE SUPPORT JMAIL or ASPMAIL--- 'This setting will overide all the others below strSendEmail = 1 'IF EMAIL OPTION = 1 THEN SPECIFY MAIL COMPONENT 'OPTIONS = "JMAIL" or "ASPMAIL" strMailComponent = "ASPMAIL" 'IF EMAIL OPTION = 1 THEN SPECIFY MAIL SERVER strMailServer = "bogazicikonut.com.tr" strDomainEmail = "admin(a)bogazicikonut.com.tr" 'Path to your where you put the classified Ads folder (Used when mail is sent to user) strDomain = "www.bogazicikonut.com.tr/classifieds" 'OPTIONAL EMAIL FUNCTIONS 'Will enable the lost password retrieval by email strSendLostPassword = 1 'Will send registration info to new users strSendNewUserInfo = 1 'NOTIFY WEBMASTER 1=YES 0=NO ---NOTIFY BY EMAIL--- strNotifyNewAds = 1 strNotifyNewUser = 1 strNameToWebmaster = "Webmaster" strSendToWebmaster = "webmaster(a)bogazicikonut.com.tr" Select Case strDatabaseFile case 1 strConn = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("db\dbClassifiedsPhoto.mdb") case 2 strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabasePath & "dbClassifiedsPhoto.mdb; Persist security Info=False" case 3 strConn = "dsn=dbclassifiedsphoto" case 4 strConn = "Provider=SQLOLEDB;Data Source=Your_SQL_Server;Initial Catalog=dbClassifiedsPhoto; User Id=Your_Login_Name; Password=Your_Password" End Select %> Upload.asp nin içeriði <%@LANGUAGE="VBSCRIPT"%> <html> <head> <title><%=strSiteName%></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Microsoft Border" content="none"> </head> <!-- #Include File="Inc_conn.asp" --> <% If Session("cAdminUserName") = "" Then If Session("UserID") = "" Then Response.Redirect "Login.asp" Else If UploadOption = 0 Then Response.Redirect "MenuForRegisteredUsers.asp" End If End If End If dim strAction strAction = CStr(Request.QueryString("action")) Select Case strAction Case "Categories" Categories Case "Ads" Ads Case "" Response.redirect ("main.asp") End Select %> <body bgcolor="#ffffff" topmargin="0"> <%'----------------------------------------------------------------- '--------------------------Upload Ads image Function --------------- Sub Ads %> <div align="center"> <table width="80%" border="0" cellspacing="0" cellpadding="2"> <tr> <td> <div align="center"> <h3><font face="Verdana, Arial, Helvetica, sans-serif">Upload Picture</font></h3> </div> </td> </tr> <tr> <td> <div align="center"> <form name="form1" method="POST" enctype="multipart/form-data" action="upload.asp?Upload=yes&Action=Ads&nAdID=<%=Request("nAdID")%>"> <table width="80%" border="0" cellspacing="0" cellpadding="2"> <tr> <td>Upload</td> <td> <input type="file" name="file1" size="20"> </td> </tr> <tr> <td> </td> <td> <input type="hidden" name="nAdId" value="<%Request("nAdID")%>"> <font size="2"><i>note: only image files are allowed and they may not exceed 100KB, <br> <br> click the browse button to select your file, then right-click to see the file properties.</i></font></td> </tr> <tr> <td> </td> <td> <input type="submit" name="action" value="Submit"> </td> </tr> </table> </form> </div> </td> </tr> </table> <% strAdId = request("nAdID") if request("Upload") = "yes" Then '---------------Upload User Ads Images-------------------- Set Upload = Server.CreateObject("Persits.Upload.1") Upload.SetMaxSize 100000, False Upload.SaveVirtual(strUploadFolder) ' <!--bolViolators = False ' For Each File in Upload.Files ' If File.ImageType <> "GIF" and File.ImageType <> "JPG" Then ' bolViolators = True ' Exit For 'End If ' ' If File.ImageWidth > 250 Then ' bolViolators = True ' Exit For ' End If ' ' If File.ImageHeight > 250 Then ' bolViolators = True ' Exit For ' End If ' ' If File.ImageType = "GIF" Then ' strFileExtension = ".gif" ' else ' strFileExtension = ".jpg" ' End If ' Next Set File = Upload.Files("FILE1") SaveFileName = strAdId & strFileExtension File.CopyVirtual SaveFileName File.Delete Set Upload = Nothing 'Now, if we didn't have any violating files, say so! If Not bolViolators then strSaveFileName = strAdId & strFileExtension Response.Write "Upload Successful..." Set rsUploadFile = Server.CreateObject("ADODB.Command") rsUploadFile.ActiveConnection = strConn rsUploadFile.CommandText = "UPDATE tblAds SET cFile = '" & strSaveFileName & "' WHERE nAdId LIKE '" & strAdId & "'" rsUploadFile.Execute Set rsUploadFile = Nothing End if %> <% If Not bolViolators then %> <p><img src="<%=strsaveFileName%>" border="1" ><br> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Uploaded image<br> To change, browse and resubmit the form above <br> <a href="javascript:location.reload()"><font color="#008000">Refresh</font></a> the page to see new image<br> </font> </p> <p><font face="Geneva, Arial, Helvetica, san-serif" size="2"><a href="modifyAds.asp?nUserId=<%=session("UserID")%>"><font color="#008000">Continue</font></a></font><br> </p> <% Else %> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Sorry, there was an error<br> The image is not a .GIF or a .JPG file or is bigger than 20KB<br> Try again<br> </font> </p> <% End if End If %> <p> </p> </div> <% End Sub '--------------------------------End Function Ads---------------------- %> <%'-------------'Function Categories image upload for Admin----------------- Sub Categories %> <div align="center"> <table width="80%" border="0" cellspacing="0" cellpadding="2"> <tr> <td> <div align="center"> <h3><font face="Verdana, Arial, Helvetica, sans-serif">Upload Category Image</font></h3> </div> </td> </tr> <tr> <td> <div align="center"> <form name="form2" method="POST" enctype="multipart/form-data" action="upload.asp?Upload=true&action=Categories&nCategoryID=<%=Request("nCategoryID")%>"> <table width="80%" border="0" cellspacing="0" cellpadding="2"> <tr> <td>Upload</td> <td> <input type="file" name="file1" size="20"> </td> </tr> <tr> <td> </td> <td> <input type="hidden" name="nCategoryId" value="<%Request("nCategoryID")%>"> </td> </tr> <tr> <td> </td> <td> <input type="submit" name="Submit" value="Submit"> </td> </tr> </table> </form> </div> </td> </tr> </table> <% strCategoryId = "cat" & request("nCategoryID") strnCategoryId = request("nCategoryID") if request("upload") = "true" Then Set Upload = Server.CreateObject("Persits.Upload.1") Upload.SetMaxSize 20000, False Upload.Save strAbsUploadPath bolViolators = False For Each File in Upload.Files If File.ImageType <> "GIF" and File.ImageType <> "JPG" Then bolViolators = True Exit For End If If File.ImageWidth > 250 Then bolViolators = True Exit For End If If File.ImageHeight > 250 Then bolViolators = True Exit For End If If File.ImageType = "GIF" Then strFileExtension = ".gif" else strFileExtension = ".jpg" End If Next Set File = Upload.Files("FILE1") SaveFileName = strAbsCatUploadPath & strCategoryId & strFileExtension File.Copy "d:\webspace\resadmin\bogazicikonut\bogazicikonut.com.tr\wwwroot\classifieds\uploads\" & File.FileName File.Delete Set Upload = Nothing If Not bolViolators then Response.Write "Upload Successful..." strSaveFileName = strCatUploadFolder & strCategoryId & strFileExtension %> <p><img src="<%=strsaveFileName%>" border="1" ><br> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Uploaded image<br> <%=strsaveFileName%><br> <br> To change, browse and resubmit the form above <br> Refresh the page to see new image<br> </font> </p> <p><font face="Geneva, Arial, Helvetica, san-serif" size="2"><a href="admincom.asp?View=Categories&Action=UPLOAD&nCategoryID=<%=strnCategoryID%>&CategoryImage=<%=strSaveFileName%>"><font color="#008000">Continue</font></a></font><br> </p> <% Else %> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Sorry, there was an error<br> The image is not a .GIF or a .JPG file or file is too big<br> Try again<br> </font> </p> <% End If End If %> </Div> <p> </p> </body> </html> <% End Sub '---------------------------------------End Categories images upload------------------- %> |