We help IT Professionals succeed at work.
Troubleshooting Question

Microsoft Access getting an error when trying to upload photos to a web site.

J.R. Sitman
J.R. Sitman asked
on
52 Views
Last Modified: 2020-08-25
I have never seen this error before.   I contacted the web hosting company and they say there is plenty of room on the web site.

It happens when we try to upload photos to our web site



Comment
Watch Question

David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
you are using FTP and the account used doesn't have write access or the device you are ftp'ing to is full
J.R. SitmanIT Director

Author

Commented:
I'll have the Web people check.

J.R. SitmanIT Director

Author

Commented:
they say nothing has changed since yesterday.   Also They said the upload we did earlier today worked.

Any thoughts?
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
drives eventually do fill up.
J.R. SitmanIT Director

Author

Commented:
Agreed, but they say we have 100 gb free
CERTIFIED EXPERT

Commented:
try to upload manually using ftp and the same account as your app is using, and see what error you get or if you are succesful
CERTIFIED EXPERT

Commented:
Also check if the file is too big for some quota or limit on server size per file, or if access can handle the size of your file (remove the specific file with error and try with another one)
J.R. SitmanIT Director

Author

Commented:
I will get instructions to test manually.

We have an unlimited quota on the site.   It is not a single file it is multiple photos.
J.R. SitmanIT Director

Author

Commented:
do you think it is "not" an Access issue?

J.R. SitmanIT Director

Author

Commented:
here is the code.   Can you check and see if you see anything based on the error message?

Private Sub SPCALAExport(strAccount As String, strPassword As String)
 
          Dim objFTP As FTP
          Dim strPath As String
          Dim imgPath As String
          Dim ftpPath As String
          Dim db As DAO.Database
          Dim rs As DAO.Recordset
          Dim rsFail As DAO.Recordset
          Dim ErrCount As Integer
 
          Const conTARGET = "ftp://members.petfinder.com"
          Const conRover = "ftp://ftp.storagemadeeasy.com"
          Const conWEBPAGE = "ftp://spcala.com"
          Const PathName = "\\databases\access2015$\Petfinder"
 
10        On Error GoTo Proc_Error_A
 
          ' initialize progress tracking textboxes
20        Me!txtAvailable = Me.RecordsetClone.RecordCount
 
30        If Me.cboLocation = "SPCALA Webpage" Then
40            Me!txtAvailable = DCount("*", "qryWebpageExport")
50        End If
 
60        Me!txtSent = 0
70        Me!txtNoPic = 0
80        Me!txtTotal = 0
90        ErrCount = 0
 
          ' export the query
100       If Me.cboLocation = "SPCALA Webpage" Then
110           strPath = PathName & "\adoptable.txt"
              'Application.ExportXML ObjectType:=acExportQuery, _
               'DataSource:="qryWebpageExport", _
               'datatarget:=strPath
120           DoCmd.TransferText acExportDelim, "Webpage Export Specification", "qryWebpageExport", strPath, True
 
130           Set objFTP = New FTP
 
140           With objFTP
150               .SourceFile = strPath
160               .FtpURL = conWEBPAGE
170               .DestinationFile = "adoptable.txt"
180               .AutoCreateRemoteDir = False
190               .ConnectToFTPHost strAccount, strPassword
200               .UploadFileToFTPServer
210           End With
220       Else
230           strPath = PathName & "\" & strAccount & ".txt"
240           DoCmd.TransferText acExportDelim, "Petfinder Export Specification", "qryPetfinderExport", strPath, True
 
250           Set objFTP = New FTP
 
260           With objFTP
270               .SourceFile = strPath
280               .FtpURL = conTARGET
290               .DestinationFile = "/import/" & strAccount & ".txt"
300               .AutoCreateRemoteDir = False
310               .ConnectToFTPHost strAccount, strPassword
320               .UploadFileToFTPServer
330           End With
340       End If
 
          'export all pictures
350       imgPath = DLookup("DefaultImagePath", "tbl_ImageDefaultPath", "ImageType='SoftSlips'")
 
360       Set db = CurrentDb
370       Set rsFail = db.OpenRecordset("tblPetfinderFailures", dbOpenDynaset)
          
380       With objFTP
390           If Me.cboLocation = "SPCALA Webpage" Then
400               .FtpURL = conWEBPAGE
410           Else
420               .FtpURL = conTARGET
430           End If
440           .ConnectToFTPHost strAccount, strPassword
450       End With
 
          ' set initial ftp
460       If Me.cboLocation = "SPCALA Webpage" Then
470           ftpPath = ""
480       Else
490           ftpPath = "/import/photos/"
500       End If
 
510       If Me.cboLocation = "SPCALA Webpage" Then
520           Set rs = db.OpenRecordset("qryWebpageExport", dbOpenDynaset)
530       Else
540           Set rs = Me.RecordsetClone
550       End If
 
560       rs.MoveFirst
          
570       On Error GoTo Proc_Error_B
 
580       Do Until rs.EOF
TryAgain:
590           If Len(rs!SoftSlipPicPathFile & "") <> 0 Then
600               If Dir(rs!SoftSlipPicPathFile) <> "" Then
610                   If Me.cboLocation <> "SPCALA Webpage" Then
620                       Me.Bookmark = rs.Bookmark
630                   End If
 
640                   With objFTP
                          '.SourceFile = imgPath & "\" & rs!SoftSlip & ".jpg"
650                       .SourceFile = rs!SoftSlipPicPathFile
660                       .DestinationFile = ftpPath & rs!SoftSlip & ".jpg"
670                       .UploadFileToFTPServer
680                   End With
 
                      ' since the focus is now on the photos folder, we don't need the path any more
                      'If Me.cboLocation <> "SPCALA Webpage" Then
690                   ftpPath = ""
                      'End If
                      
700                   Me!txtUploading = rs!SoftSlip
710                   Me!txtSent = Me!txtSent + 1
720               Else
730                   Me!txtNoPic = Me!txtNoPic + 1
740               End If
750           Else
760               Me!txtNoPic = Me!txtNoPic + 1
770           End If
780           Me!txtTotal = Me!txtTotal + 1
790           Me.Repaint
800           rs.MoveNext
810       Loop
 
PROC_EXIT:
820       On Error Resume Next
 
830       If Not rsFail Is Nothing Then
840           rsFail.close
850           Set rsFail = Nothing
860       End If
         
870       If Not rs Is Nothing Then
880           rs.close
890           Set rs = Nothing
900       End If
          
910       Set objFTP = Nothing
 
920       Exit Sub
 
Proc_Error_A:
930       MsgBox "Error " & Err.Number & " on line " & VBA.Erl & "in SPCALAExport" & vbCrLf & Err.Description
940       Resume PROC_EXIT
 
Proc_Error_B:
950       Select Case Err.Number
              Case 52
                  ' Added this to handle "Bad Filename or number" errors, and log SS and filepaths that cause this error in tblPictureUploadFailures
960               LogUploadFailure rs!SoftSlip, rs!SoftSlipPicPathFile
970               Resume Next  ' Move on to the next SS
980           Case -2147219289    ' FTP switching to binary
990               ErrCount = ErrCount + 1
1000              If ErrCount < 6 Then
1010                  With objFTP
1020                      If Me.cboLocation = "SPCALA Webpage" Then
1030                          .FtpURL = conWEBPAGE
1040                      Else
1050                          .FtpURL = conTARGET
1060                      End If
1070                      .ConnectToFTPHost strAccount, strPassword
1080                  End With
1090                  Resume TryAgain
1100              Else
1110                  rsFail.AddNew
1120                  rsFail!SoftSlip = rs!SoftSlip
1130                  rsFail!faildate = Now
1140                  rsFail.Update
 
1150                  ErrCount = 0
1160                  rs.MoveNext
1170                  If rs.EOF Then
1180                      Resume PROC_EXIT
1190                  Else
1200                      Resume TryAgain
1210                  End If
1220              End If
1230          Case Else
1240              MsgBox "Error " & Err.Number & " on line " & VBA.Erl & "in SPCALAExport" & vbCrLf & Err.Description
1250      End Select
 
1260      Resume PROC_EXIT
 
End Sub
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
J.R. SitmanIT Director

Author

Commented:
There were a couple of large photos.  I deleted them, but that did not help
CERTIFIED EXPERT

Commented:
seems to me like the problem is not an image but a txt file, anyway please try this and see the error again, it might show you where the problem is

please replace line 930
with:
930       MsgBox "Error " & Err.Number & " on line " & VBA.Erl & "in SPCALAExport" & vbCrLf & Err.Description & "On file TXT:" & strPath & "to " & ftpPath & "JPG:" & rs!SoftSlipPicPathFile
CERTIFIED EXPERT

Commented:
it can even be a long path problem , this happen in windows when the file path  plus the filename are very long, but I doubt this would be a problem on the server, just trying to figure out whats the culprit.
J.R. SitmanIT Director

Author

Commented:
see attached
CERTIFIED EXPERT

Commented:
include the filename, path, record if and any information that can help you pinpoint the problem in your error message, this additional info you can remove after you find out the problem, in case you dont want it shown.
J.R. SitmanIT Director

Author

Commented:
FYI I am not a programmer.    Can you tell me exactly what to do?
CERTIFIED EXPERT

Commented:
ok lets go by parts use

930       MsgBox "Error " & Err.Number & " on line " & VBA.Erl & "in SPCALAExport" & vbCrLf & Err.Description & "On file TXT:" & strPath

then we go from there
J.R. SitmanIT Director

Author

Commented:
I sent your post "size per file" to the Web people.   They reset all the limits.   It worked
THANK YOU so much.
CERTIFIED EXPERT

Commented:
good you got it working,

the it must be the FTP Quota, have them check those values and if they used to work before but maybe you now have a lot more information than before, then quota could have been reached, this quota has nothing to do with space available on the server , but on a limit of total upload/download by FTP transfers, this can be set by account or globally for your server.
J.R. SitmanIT Director

Author

Commented:
He said he reset the limits.

Thanks again,  
CERTIFIED EXPERT

Commented:
Kudos for working towards  THE PREVENTION OF CRUELTY TO ANIMALS
J.R. SitmanIT Director

Author

Commented:
Great organization.  I've been here for 20 years.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.