Good Afternoon Friends
Please suggest me to solve this problem :
when we upload image file (or any file) we are storing file name & file path in database...
and file was storing in one folder ...
When we are retrieving file name we are getting file name from database, based on file name respective file is displaying from folder...
This was executing in local machine fine...
but when we upload into server file was not storing into folder which is present in server.
But retrieving is good (working fine)
I tested with default file stores in folder in server.
That file is retrieving fine.
But the problem is When i browse any file that file should store in folder which is in server.
This is the problem we are facing...
To store that we taken handler.ashx file in c#.
C# Code in Handler1.ashx :
string fileName = "";
string SaveLocation = HttpContext.Current.Server.MapPath("flex-bin/assets/Uploads/");
if (context.Request.Files.Count == 0)
{
context.Response.Write("True");
}
else
{
foreach (string filekey in context.Request.Files)
{
HttpPostedFile file = context.Request.Files[filekey];
file.SaveAs(SaveLocation + file.FileName);
fileName = file.FileName;
}
context.Response.Write("upload: " + SaveLocation + fileName);
}
Flex Code for FileUpload :
public var f1:FileReference=new FileReference();
public var imgName:String;
protected function btnAddBrochure_clickHandler(event:MouseEvent):void
{
f1.addEventListener(Event.SELECT, selectedManageBrochures);
f1.browse();
}
protected function selectedManageBrochures(event:Event):void
{
var request:URLRequest=new URLRequest("http://localhost:1149/Handler1.ashx");
try
{
f1.upload(request);
imgName=event.target.name;
}
catch(error:Error)
{
trace(error);
}
}
File should store in
http://bria.indusrays.com/flex-bin/Uploads/
(Uploads is folder in flex-bin folder)
Please give suggesion to overcome this problem