locked
Photos not displaying after uploading RRS feed

  • Question

  • User-390097995 posted

    I have tried to upload the photos to the Upload directory and to the database, neither of which allowed for me to view the photos.  All that appears is "X Item Photo" in the thumbnail.

     

    Thanks,

    Tim 

    Tuesday, January 4, 2011 10:40 PM

All replies

  • User1992938117 posted

    If possible share the code

    also at first look it seems that you have problem in your image Path.

    Wednesday, January 5, 2011 1:39 AM
  • User-390097995 posted

    Now the photo uploads are working on my local PC, but not when the same code is uploaded to my webhost.  The code used is from the ManagePhotos.aspx page.

    Here is the code when uploading an image file.

    Protected Sub UploadPhotoDetailsView_ItemInserting(ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs)
      Dim uploadedOriginal As Byte() = CType(e.Values("UploadBytes"), Byte())
      If uploadedOriginal Is Nothing OrElse uploadedOriginal.Length = 0 Then
       e.Cancel = True
       UploadErrorMessage.Visible = False
      Else
       Try
        ' adding resized photo bytes to arguments
        Dim fullSize As Byte() = PhotosDB.ResizeImageFile(uploadedOriginal, PhotoSize.Full)
        Dim mediumSize As Byte() = PhotosDB.ResizeImageFile(uploadedOriginal, PhotoSize.Medium)
        Dim smallSize As Byte() = PhotosDB.ResizeImageFile(uploadedOriginal, PhotoSize.Small)

        e.Values.Add("bytesFull", fullSize)
        e.Values.Add("bytesMedium", mediumSize)
        e.Values.Add("bytesSmall", smallSize)

        ' removing original upload bytes from arguments
        e.Values.Remove("UploadBytes")

        ' if this is the first ad photo uploaded, use it as the preview
        Dim useAsPreview As Boolean = PhotoGridView.Rows.Count = 0
        e.Values.Add("useAsPreview", useAsPreview)
        UploadErrorMessage.Visible = False
       Catch
        ' image format was not acceptable
        e.Cancel = True
        UploadErrorMessage.Visible = True
       End Try
      End If
     End Sub

    Thursday, January 6, 2011 10:56 PM
  • User730446648 posted

    Assuming you haven't found a sollution . .

    If all works fine on your local host, I would be that you need to login to your host server.
    Go to the file directory, and make sure the folder you want the images uploaded to has write, and view restrictions enabled.
    Most by default are read only.

    Good Luck

    Daniel 

    Sunday, February 6, 2011 2:37 PM