How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name?
How do I get previously stored image file name? How do I get previously stored image file name?
How do I get previously stored image file name?
Go Back  Xtreme Visual Basic Talk > > > How do I get previously stored image file name?


Reply
 
Thread Tools Display Modes
  #1  
Old 11-03-2017, 09:52 AM
publiczne publiczne is offline
Newcomer
 
Join Date: Nov 2017
Location: Warsaw, Poland
Posts: 1
Default How do I get previously stored image file name?


When I click on the edit button then image will display in input type="file" control using dropify.

When I'm selecting a new file its working properly, but if I'm not selecting any file, then I want to get the previously uploaded file name from the database and pass it as below:

Code:
<img src='<%# "~/Images/" + Eval("photo") %>' id="imgphoto" runat="server" style="width:70px;"/>
Code:
var appDataPath = Server.MapPath("../Images/");
if (!Directory.Exists(appDataPath))
{
    Directory.CreateDirectory(appDataPath);
}
string straa = editphoto.PostedFile.FileName;
var filePath = Path.Combine(appDataPath, Path.GetRandomFileName() + straa);
using (var output = File.Create(filePath))
{
    if (editphoto.PostedFile.FileName.Equals(null))
    {
        editphoto.PostedFile.SaveAs(Server.MapPath("../Images/" + output));
        photo = output.ToString();
    }
    else
    {
        con.DisplaydataById(Request.QueryString["empid"]);
        photo = con.photo;
    }
}
Reply With Quote
Reply

Tags
file, var, selecting, photo, previously, image, straa, server.mappath, filepath, /images/;, appdatapath, string, output, output.tostring;, output;, con.photo;, /images, straa;, path.getrandomfilename, file.createfilepath, path.combineappdatapath, display, input, type=file, dropify


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name? How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name? How do I get previously stored image file name?
How do I get previously stored image file name?
How do I get previously stored image file name?
 
How do I get previously stored image file name?
How do I get previously stored image file name?
 
-->