Skip to content

Commit ebda19b

Browse files
committed
fix product img + doc upload
1 parent ce09324 commit ebda19b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Components/Product/ProductFunctions.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,14 @@ public string UpdateProductImages(HttpContext context)
914914
{
915915
if (ImgUtils.IsImageFile(Path.GetExtension(img)) && img != "")
916916
{
917+
var extension = Path.GetExtension(img);
917918
var fn = DnnUtils.Encrypt(img, StoreSettings.Current.Get("adminpin"));
918919
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
919920
{
920921
fn = fn.Replace(c, '_');
921922
}
922-
var extension = Path.GetExtension(img);
923+
fn = extension + "-" + fn; // add extension to front, so it cannot be servered but we can add to order data.
924+
923925
var fullName = StoreSettings.Current.FolderTempMapPath.TrimEnd(Convert.ToChar("\\")) + "\\" + fn;
924926
if (File.Exists(fullName))
925927
{
@@ -929,7 +931,7 @@ public string UpdateProductImages(HttpContext context)
929931
imageInfo = NBrightBuyUtils.ProcessImageProvider("product", imageInfo);
930932
var newfullName = imageInfo.GetXmlProperty("genxml/uploadedimagemappath");
931933
if (newfullName != "") fullName = newfullName;
932-
934+
933935
// deal with image
934936
File.Move(fullName, fullName + extension);
935937
fullName = fullName + extension;
@@ -1156,8 +1158,9 @@ public string UpdateProductDocs(HttpContext context)
11561158
{
11571159
fn = fn.Replace(c, '_');
11581160
}
1161+
fn = extension + "-" + fn; // add extension to front, so it cannot be servered but we can add to order data.
11591162

1160-
string fullName = StoreSettings.Current.FolderTempMapPath + "\\" + fn;
1163+
var fullName = StoreSettings.Current.FolderTempMapPath.TrimEnd(Convert.ToChar("\\")) + "\\" + fn;
11611164
//if ((extension.ToLower() == ".pdf" || extension.ToLower() == ".zip"))
11621165
//{
11631166
if (File.Exists(fullName))

0 commit comments

Comments
 (0)