asp.net mvc - Saving file to App_Data doesn't seem to work when app is uploaded to Azure -
i have small mvc 5 app, , point works fine in localhost, when publish azure, parts doesn't work. example, have in view:
<div class="form-group"> <div style="position:relative;"> <label>image</label> <a class="btn" href="javascript:;"> choose file... <input type="file" name="image" accept="image/jpeg, image/png" style="position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0); opacity:0;background-color:transparent;color:transparent;" onchange='$("#upload-image-info").html($(this).val());' /> </a> <span class="label label-info" id="upload-image-info"></span> </div> </div>
so, in server side have this:
public actionresult servicerequest(requestviewmodel rvm, httppostedfilebase image = null, httppostedfilebase video = null) { tmppicturepath = server.mappath("~/app_data/uploads/images"); tmpvideopath = server.mappath("~/app_data/uploads/videos"); // check properties, , save file filename = path.getfilename(image.filename); imagepath = path.combine(tmppicturepath, filename); image.saveas(imagepath); // afterwards, give imagepath sendgrid attachment mail message.addattachment(imagepath); // , later in code, send mail transportweb.deliver(message); }
please note omitted parts of code above, make more clear want do. point in localhost, works fine, able select file , after uploading it, sends via e-mail. but, when publish website on azure, , try same thing, when press button seems uploading file, afterwards error message saying:
error. error occurred while processing request.
i don't know whether cannot store files on server, or cannot read them afterwards attachment, or cannot send mail. idea problem may be?
i connected ftp server , manually created folders, worked okay.
Comments
Post a Comment