Restrict an user didn't allow the image to upload in to gallery with spaces included in image name

Last post 02-13-2014, 8:12 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  02-10-2014, 1:26 AM 79907

    Restrict an user didn't allow the image to upload in to gallery with spaces included in image name

    Hi,

     

                I am using Image Gallery (classic) in my asp.net application. When the user uploading an image into Gallery, If the uploaded

     

    image have the name containing spaces. Then the gallery doesn't allow that image to upload and want to show alert as 

     

    "Invalid File name Please remove spaces in the image name and upload again".

     

    how can I achieve this..? It's too late..

     

    Please give quick reply..

     

    Thanks in advance.. 


    Regards,
    Narendra
  •  02-11-2014, 7:29 AM 79912 in reply to 79907

    Re: Restrict an user didn't allow the image to upload in to gallery with spaces included in image name

    Hi narendrababu,

     

    I have tried on http://cutesoft.net/ASP.NET+Image+Gallery/Classic-Layout.aspx  with file name "1   2.jpg", it works fine. Can you try on this demo too? What file name you are testing?

     

    Regards,

     

    Ken 

  •  02-13-2014, 1:16 AM 79918 in reply to 79912

    Re: Restrict an user didn't allow the image to upload in to gallery with spaces included in image name

    Hi,

     

               Yes, It's uploading and working fine. But when I reload that particular page. It's could not be loaded and giving error as 

     

    "Memory Out of Exception" . If I removed that image(name contains spaces), then the page is loading and working fine. So problem is 

     

    that  only. So I want to restrict user to upload the pictures whose name contains spaces.

     

    Please give me solution as soon as possible

     

    Thanks in advance.. 


    Regards,
    Narendra
  •  02-13-2014, 8:12 AM 79923 in reply to 79918

    Re: Restrict an user didn't allow the image to upload in to gallery with spaces included in image name

    Hi,

     

    The gallery has an event "PostProcessImage", you can handle the upload image name in it. Like the code below to remove all spaces for the image.

     

    1. protected void GalleryBrowser1_PostProcessImage(object sender, GalleryImageEventArgs args)  
    2. {  
    3.   
    4.     args.Title = args.Title.Replace(" """);  
    5. }  
     

    Regards,

     

    Ken 

View as RSS news feed in XML