473,573 Members | 2,866 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SA Upload SQL Database variable types (image upload and storage)

12 New Member
SA Upload SQL Database variable types (image upload and storage)

I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something.

Expand|Select|Wrap|Line Numbers
  1. <form name="UpdatePropertyPicture" method="POST" action="UpdatePropertyPicture.asp"><p><strong><font size="5">Property Picture</font></strong><br>
  2.   </p>
  3. <p><font face="Times New Roman"><b>Current Property Picture for this listing:</b></font></p>
  4. <table border="0" cellpadding="0" width="100%" cols=4>
  5. <td>
  6. </td>    
  8. <%
  9. Set rs = Server.CreateObject("ADODB.Recordset")
  10. SQL = "Select list_id, PictureName"
  11. SQL = SQL & " from tblDescr"
  12. SQL = SQL & " where list_id = " & varlistid
  14. 'open the recordset
  15. rs.Open SQL, cn
  16. varPicture = rs("PictureName")
  17. rs.close
  18. cn.Close
  19. %>
  21.   <tr>
  22.     <td width="1%"><input type="hidden" size="15" maxlength="15" name="txtlistid" value="<%=varlistid%>"></td>
  23.     <td width="12%" valign="top">
  24.        <%If varpicture = "" Then%>
  25.             No Picture
  26.        <%Else%>
  27.             <input type="checkbox" name="chkPropertyPicture" value="<%=varPicture%>">
  28.             <%=varPicture%>
  29.             <input TYPE="HIDDEN" Name="h<%=I%>" VALUE="<%=varPicture%>">
  30.        <%End If%>
  31.     </td>
  32.     <td width="25%" align="center">
  33.       <img src="images/Pictures/<%=varPicture%>" height="275" width="225" align="center">    </td>
  34.     <td width="25%">
  35.         <input TYPE="SUBMIT" NAME="btnUploadPicture" VALUE="Upload Property Picture">
  36.     </td>
  37.   </tr>
  39.   <tr>
  40.     <td></td>
  41.     <td align="center"><input type="submit" value="Delete" id="btnDelete" name="btnDelete"></td>
  42.     <td></td>
  43.     <td></td>
  44.   </tr>
  46.   </tr>
  47.     <td></td>
  48.     <td></td>
  49.     <td></td>
  50.     <td></td>
  51.   </tr>
  53.   </tr>
  54.     <td></td>
  55.     <td></td>
  56.     <%If Session("AddUpdatePic") = "Add" Then%>
  57.         <td align="center"><input type="submit" id="bntExitAdd" value="Continue to Unit Mix" name="bntExitAdd">&nbsp;&nbsp;<input TYPE="Button" NAME="btnReload" VALUE="Reload Picture" onClick="javascript:location.reload();"></td>
  58.     <%Else%>
  59.         <td align="center"><input type="submit" id="bntExitUpdate" value="Return to Update Property" name="bntExitUpdate">&nbsp;&nbsp;<input TYPE="Button" NAME="btnReload" VALUE="Reload Picture" onClick="javascript:location.reload();"></td>
  60.     <%End If%>
  61.     <td></td>
  62.   </tr>
  63. </table>
  65. </FORM>
And this is the response page for after the image is uploaded:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. 'Instanciate SA-FileUp
  3. Set upl = Server.CreateObject("SoftArtisans.FileUp")
  5. 'Set the default path to store uploaded files. 
  6. 'upl.Path = "d:\inetpub\wwwRoot\cartergroup\Images\Pictures"    'Use this path for WCDEV03
  7. 'upl.Path = "d:/inetpub/wwwroot/cartergroup.com/www/phase2/images/Pictures/"                'Use this path for TS
  8. upl.Path = "d:/inetpub/wwwroot/kansascitycs.atempsite.com/www/falconbuilt/uploads/"
  9. varlistid = session("listid")
  10. %>
  12. <%If upl.IsEmpty Then %>
  13.     The file that you uploaded was empty. Most likely, you did not specify a valid
  14.     filename to your browser or you left the filename field blank. Please try again.
  16. <%ElseIf upl.ContentDisposition <> "form-data" Then %>
  17.     Your upload did not succeed, most likely because your browser
  18.     does not support Upload via this mechanism.
  19.     <br>
  20.     For Internet Explorer Users:
  21.     <UL>
  22.         <LI>For Windows 95 or Windows NT 4.0:
  23.         <UL>
  24.             <LI><A HREF="http://www.microsoft.com/ie/">Download</A> V3.02 or later of Internet Explorer
  25.             <LI><A HREF="http://www.microsoft.com/ie/download">Download</A> the File Upload Add-on
  26.             <LI>For further information, See Knowledge Base Article <A HREF="http://www.microsoft.com/kb/articles/Q165/2/87.htm">Q165287</A>
  27.         </UL>
  28.         <LI>For Windows 3.1, WFW 3.11 (Windows 16-bit), or Windows NT 3.51:
  29.         <UL><A HREF="http://www.microsoft.com/ie/">Download</A> V3.02A or later of Internet Explorer for 16-bit Windows
  30.         </UL>
  31.     </UL>
  32.     For Netscape Users:
  33.     <UL>
  34.         <LI><A HREF="http://home.netscape.com">Download</A> a version of Netscape Navigator or Communicator of 2.x or later
  35.     </UL>
  36.     For users of other browsers:
  37.     <UL>
  38.         <LI>Your browser must support a standard called RFC 1867. Please check with your browser vendor for
  39.     support of this standard.
  40.     </UL>
  42. <%Else %>
  43.     <P><center>Your picture has been successfully transmitted to your listing.</center></P>
  44. <% 
  45.     on error resume next
  47.     dim strFilename
  48.     dim strExtension
  49.     dim strFilename2
  51.     strExtension = Mid(upl.UserFilename, InstrRev(upl.UserFilename, ".") + 1)
  52.     strFilename = "pic" & trim(varlistid) & "." & lcase(strExtension)
  54.     If strExtension = "jpg" or strExtension = "gif" Then
  55.         '--- Save file - use the listID as the filename with the extension of the original file
  56.         upl.SaveAs strfilename
  57.     Else
  58.         Err = 1
  59.     End If
  61.     If Err <> 0 Then %>
  62.         <H1><FONT COLOR="#ff0000">An error occurred when saving the file on the server.</FONT></H1>
  63.             Possible causes include:
  64.         <UL>
  65.             <LI>An incorrect filename was specified
  66.             <LI>File permissions do not allow writing to the specified area
  67.             <LI>Your picture has an extension other than .jpg or .gif
  68.         </UL>
  69.         Please check the SA-FileUp documentation for more troubleshooting information,
  70.         or send e-mail to <A HREF="mailto:info@softartisans.com">info@softartisans.com</A>
  72.     <%Else 
  73.         'Response.Write("Upload saved successfully to " & upl.ServerName)
  74.         Response.Write("<center>Your picture has been saved successfully.</center>")
  76.         'Get current file extension
  77.         Set rs = Server.CreateObject("ADODB.Recordset")
  78.         SQL = "SELECT PictureName FROM tblDescr "
  79.         SQL = SQL & "WHERE list_id = " & varlistid
  80.         'open the recordset
  81.         rs.Open SQL, cn
  83.         If not rs.EOF Then
  84.             varSavPrevPic = rs("PictureName")
  85.         Else
  86.             varSavPrevPic = ""
  87.         End If
  88.         rs.close
  90.         If strExtension <> right(varSavPrevPic,3) Then
  91.             'strFilename2 = "d:\inetpub\wwwRoot\cartergroup\Images\Pictures\" & varSavPrevPic    'Use this path for WCDEV03
  92.             strFilename2 = "d:/inetpub/wwwroot/cartergroup.com/www/phase2/images/Pictures/" & varSavPrevPic            'Use this path for TS
  94.             'If user uploaded a logo with a different extension - it now needs to be removed from the logos directory
  95.             Set fso = CreateObject("Scripting.FileSystemObject")
  96.             Set MyFile = fso.GetFile(strFilename2)
  97.             MyFile.Delete
  98.         End If
  100.         Set rs = Server.CreateObject("ADODB.Recordset")
  101.         SQL = "UPDATE tblDescr "
  102.         SQL = SQL & "SET PictureName = '" & strFilename & "' "
  103.         SQL = SQL & "WHERE list_id = " & varlistid
  104.         'open the recordset
  105.         rs.Open SQL, cn
  106.         rs.close
  107.         cn.Close
  108.     End If%>
Sep 24 '08 #1
7 3723
2,878 Recognized Expert Specialist
Lots of reason. What error is showing up?

-- CK
Sep 24 '08 #2
12 New Member
An error occurred when saving the file on the server.
Possible causes include:

* An incorrect filename was specified
* File permissions do not allow writing to the specified area
* Your picture has an extension other than .jpg or .gif

Please check the SA-FileUp documentation for more troubleshooting information, or send e-mail to info@softartisa ns.com

Information About The Uploaded File
User's filename: pic26.jpg
Size in bytes: 0
Content Type:
Content Disposition:
MIME Version:
Content Transfer Encoding:
Sep 24 '08 #3
2,878 Recognized Expert Specialist
Check the rights...Also check if the SP can "see" the file.

-- CK
Sep 25 '08 #4
12 New Member
Check the rights...Also check if the SP can "see" the file.

-- CK
WHAT IS SP? Sorry for the dumb question.
Sep 25 '08 #5
2,878 Recognized Expert Specialist
your Stored Procedure

-- CK
Sep 25 '08 #6
12 New Member
your Stored Procedure

-- CK
I don't exactly know how to check the SP and if it can see the file.
Sep 25 '08 #7
2,878 Recognized Expert Specialist
Looks like the uploading did not goes through SQL Server. Did you include the SA_FileUp file? It looks like it just save the file using the SaveFile method then updates the table accordingly. If everything seems to be working fine before and you just recreated your database from a backup, try checking the rights both in File Directory and in the db

-- CK
Sep 25 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem...
by: Code4u | last post by:
I need to design data storage classes and operators for an image processing system that must support a range of basic data types of different lengths i.e. float, int, char, double. I have a template class that stores the data. The problem with this design is the inability to treat image data generically- I have a set of specialized classes...
by: bob garbados | last post by:
I am trying to create a database-driven photo gallery for a friend with an admin form to upload images... I can upload a file to the web server, but I want to store the image in a database and I want to resize the image before I save it... How do I take the uploaded .jpg and shrink it to a thumbnail? How do I pass the uploaded .jpg to a stored...
by: Shapper | last post by:
Hello, I created a script to upload a file. To determine the file type I am using userPostedFile.ContentType. For example, for a png image I get "image/png". My questions are: 1. Where can I find a list of all the types which can be returned? For example, if it is a Word document will it return "document/doc".
by: Seok Bee | last post by:
Dear Experts, I currently trying to use the FileUpload control from asp.net 2.0 to upload files. The uploading of the file I would like to store it in the Access Database. Unfortunately, I've no idea how I can do that. Can anyone provide me some solution by writing the code in vb.net? Many thanks in advance. Regards,
by: SEMIH DEMIR | last post by:
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. ...
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. ...
by: acoder | last post by:
How to Upload a File in Coldfusion Use the cffile tag for uploading files to the server. Note that allowing people to upload files is fraught with danger and only trusted users should be allowed to upload files. Checks should be made to make sure that only allowed file types are uploaded. The Client-Side First of all, let us deal with...
by: jhardman | last post by:
Have you ever wanted to upload files through a form and thought, "I'd really like to use ASP, it surely has that capability, but the tutorial I used to learn ASP didn't mention how to do this."? Have you looked around trying to find simple solutions but didn't want to wade through pages of complex code? Have you balked at paying for premade...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.