public delegate void PersistDelegate();
[PXOverride]
public void Persist(PersistDelegate baseMethod)
{
try
{
if (Base.Document.Current != null)
{
ARRegisterExt aRInvoiceExt = PXCache<ARRegister>.GetExtension<ARRegisterExt>(Base.Document.Current);
if (aRInvoiceExt != null)
{
if (aRInvoiceExt.UsrWingAmount == null || aRInvoiceExt.UsrWingAmount != Base.Document.Current.CuryOrigDocAmt)
{
aRInvoiceExt.UsrWingAmount = Base.Document.Current.CuryOrigDocAmt;
//Generation http url
var client = new RestClient();
string imageUrl = "https://material.angular.io/assets/img/examples/shiba2.jpg";
var request = new RestRequest(imageUrl, Method.GET);
byte[] data = client.DownloadData(request);
PX.SM.FileInfo file = new PX.SM.FileInfo("AR" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.ToString("HHmmss") + ".jpg", "WingQR", data);
var uploadFileMaintenance = PXGraph.CreateInstance<UploadFileMaintenance>();
uploadFileMaintenance.SaveFile(file);
PXNoteAttribute.AttachFile(Base.Document.Cache, Base.Document.Current, file);
aRInvoiceExt.UsrWingUID = file.UID;
}
}
}
}
catch (PXException ex)
{
throw ex;
}
baseMethod();
}
the code above working fine in invoice save. but when I create prepare invoice from shipment, the file link show illegal file path like this

