hi
I have file name like this "2019 03 04 101905_RE Indonesia Possible opposition against the trademark application no 2019 03 04 101 D002014017706 AVATARA in the name of IGB GANGGA D002014017706 AV111111111112019 03 04 101905_RE Indonesia Possi.pdf"
when i try to upload that file name in AsyncUpload control it through the error like this below screen shot.
7 Answers, 1 is accepted
Hi,
same problem for me. Drag'n'Drop an email out of outlook to the desktop will create a file name using the email subject and adding .msg. I need a possibility to change the filename before or while uploading (not after because you cannot save these lang filename in the upload folder because of the 255 chars restriction. Anyone any idea to handle this???
Best
Oliver
Any client side function to validate file name if more than 255 ? in telerik demo upload page also got same problem, but not have any error msg popup to end user.
screenshot : http://prntscr.com/mxmzzk
http://prntscr.com/mxn0jx
Pls reply asap
We are currently testing this:
https://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/how-to/how-to-extend-the-radasyncupload-handler
Looks very promising for me at the moment
best
Oliver
The error occurs in this method:
Telerik.Web.UI.AsyncUpload.ContentAppender.AppendToFile(String fullPath, Stream content, Int32 retries) --> System.IO.PathTooLongException
This might be a problem of the used .Net Framework, have a look at the following MS page:
https://docs.microsoft.com/de-de/dotnet/api/system.io.pathtoolongexception?view=netframework-4.7.2
I'm glad you've found out some directions to resolve this issue. If the problem remains I suggest that you open a formal support ticket and send us a working sample so we can assist you more precisely. This will allow us to further research the scenario and provide appropriate details based on the case.
Regards,
Eyup
Progress Telerik
Hi, when upload telerik demo upload control also same problem, currently we restrict file name length upto 150, so it temporary it solved,but how if file name above 255 ? bcz when upload file name length above 255, it throw error in resource scrip , it cant handle.
http://prntscr.com/n3jytd
http://prntscr.com/n3jymq
Hi,
for me the only way was to create a custom HttpHandler within the RadAsyncUpload Control. I overwrite the base.ProcessRequest and handle the Chunk File handling by myself. I do not use the Telerik tmp file naming.
public
new
void
ProcessRequest(System.Web.HttpContext context)
{
try
{
if
(AsyncUpload.IsAsyncUploadWorkaroundEnabled)
{
string
RawCMD = context.Request.Form[CHUNK_METADATA];
if
(!
string
.IsNullOrWhiteSpace(RawCMD))
{
AsyncUploadChunkMetaData aucmd = JsonConvert.DeserializeObject<AsyncUploadChunkMetaData>(RawCMD);
if
(aucmd.UploadID.Length > 100)
{
aucmd.UploadID = FileUtils.TruncateFileName(aucmd.UploadID, MaxFileName);
SetFormValue(context.Request.Form, CHUNK_METADATA, JsonConvert.SerializeObject(aucmd));
}
}
}
base
.ProcessRequest(context);
}
catch
(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
throw
;
}
}
private
void
SetFormValue(System.Collections.Specialized.NameValueCollection form,
string
key,
string
value)
{
// Get the "IsReadOnly" protected instance property.
var propInfo = form.GetType().GetProperty
(
"IsReadOnly"
, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic
);
// Mark the form collection as NOT "IsReadOnly"
propInfo.SetValue(form,
false
,
new
object
[] { });
// Change the value of the key.
form[key] = value;
// Mark the form collection back as "IsReadOnly"
propInfo.SetValue(form,
true
,
new
object
[] { });
}
This was (for me) the only way to fix this 16bit SYSTEM.IO problem.
Best
Oliver