diff --git a/APPL/IMP/imp_inlezen.asp b/APPL/IMP/imp_inlezen.asp index e0cb3b9ee2..82ab28badf 100644 --- a/APPL/IMP/imp_inlezen.asp +++ b/APPL/IMP/imp_inlezen.asp @@ -48,6 +48,11 @@ fileData = UploadRequest.Item("imp_file").Item("Value") filepathname = UploadRequest.Item("imp_file").Item("FileName") + If fileData = "" Then + VB_getfile = L("lcl_imp_fileempty") + Exit Function + End If + safefilename = safe.filename(Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))) '' Extensie controle, ook al slaan we het nooit op Set re = new regexp diff --git a/APPL/IMP/imp_shared.js b/APPL/IMP/imp_shared.js index c8d920a98c..2c64c0f8cd 100644 --- a/APPL/IMP/imp_shared.js +++ b/APPL/IMP/imp_shared.js @@ -127,6 +127,13 @@ function impReadStream(fileStream, import_app_key, params) oZIP.Close(); } + if( !fileStream.Size ) // Leeg bestand? + { + return { success: false, + backDir: backDir, // Ongeldig bestand wel weg-moven + warning: "Import error: file is empty" }; + } + // Altijd naar win1252 converteren, dat heeft onze database ook fileStream.Position = 0; fileStream.Type = 2; // adTypeText nu @@ -154,7 +161,9 @@ function impReadStream(fileStream, import_app_key, params) win1252Stream.Position = 0 if( ! source.loadXML(win1252Stream.ReadText) ) // Het bestand laden { - return { success: false, warning: "XML error: " + source.parseError.reason + " @ " + source.parseError.line + "." + source.parseError.linepos }; + return { success: false, + backDir: backDir, // Ongeldig bestand wel weg-moven + warning: "XML error: " + source.parseError.reason + " @ " + source.parseError.line + "." + source.parseError.linepos }; } // Load the XSLT @@ -165,7 +174,9 @@ function impReadStream(fileStream, import_app_key, params) style.setProperty("ProhibitDTD", false); // niet moeilijk doen over DTD's if( ! style.load(xslfile) ) // De stylesheet laden { - return { success: false, warning: xslfile + "\nXSL error: " + style.parseError.reason + " @ " + style.parseError.line + "." + style.parseError.linepos }; + return { success: false, + // backDir: backDir, // het import bestand is gewoon geldig dus laten staan tot iemand de xsl-error oplost + warning: xslfile + "\nXSL error: " + style.parseError.reason + " @ " + style.parseError.line + "." + style.parseError.linepos }; } fileData = source.transformNode(style); // terugstoppen in de fileData string // of?: xslproc.output = win1252Stream;