Debugging "Attachment upload failed" message.

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
cwolf
Posts: 3
Joined: Thu Sep 25, 2008 11:49 am

Debugging "Attachment upload failed" message.

Post by cwolf » Thu Sep 25, 2008 12:01 pm

Hi everyone,

I am using the code below in an ASPX page to create an Item in Fortress and attach a file to it. I have Fortress installed locally on my dev machine.

The item get's created just fine but the file does not attach. I get the dreaded "Attachment upload failed" message.

The resulting debug info in my browser is:

Attachment upload failed
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Attachment upload failed

Source Error:

Line 85:
Line 86: currMantisItem.AddedAttachments = objAttFullDetailCol;
Line 87: ItemTrackingOperations.ProcessCommandAddFortressItem(currMantisItem);
Line 88:
Line 89: // List the open fortress items again

Source File: c:\Inetpub\wwwroot\AddFortressItem\Default.aspx.cs Line: 87

Stack Trace:

[Exception: Attachment upload failed]
VaultClientOperationsLib.ClientInstance.AddItem(MantisItem& item) +349
VaultClientIntegrationLib.ItemTrackingOperations.ProcessCommandAddFortressItem(MantisItem item) +147
Fortress.FortressTest.AddFortressItem() in c:\Inetpub\wwwroot\AddFortressItem\Default.aspx.cs:87
Fortress.FortressTest.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\AddFortressItem\Default.aspx.cs:35
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436



Here is my code:

Code: Select all

// Make a new fortress item
FortressItemExpanded newItem = new FortressItemExpanded();

newItem.ProjectName = projectName;
newItem.Description = "Test Attachment";
newItem.Details = "Some details about the new item.";
newItem.Status = "Open";
newItem.Assignee = "cwolf";
newItem.Resolver = "cwolf";
newItem.Platform = "Unknown";
newItem.ItemType = "Bug";
newItem.TimeEstimate = "Unknown";
newItem.Priority = "Low";
newItem.Validate();  // Call Validate after setting all your strings for your item and before you pass the item to a method.

// Upload some files
MantisItem currMantisItem = newItem.GetMantisItem();
MantisItemAttachmentFullDetail objAtt = new MantisItemAttachmentFullDetail();
MantisItemAttachmentFullDetailColl objAttFullDetailCol = new MantisItemAttachmentFullDetailColl();

objAtt.LocalPath = "C:\\";
objAtt.FileName = "ActExtLog.txt";
objAttFullDetailCol.Add(objAtt);

currMantisItem.AddedAttachments = objAttFullDetailCol;
ItemTrackingOperations.ProcessCommandAddFortressItem(currMantisItem);
Am I not specifying the LocalPath correctly?

Thanks!!

- Chris Wolf

cwolf
Posts: 3
Joined: Thu Sep 25, 2008 11:49 am

Re: Debugging "Attachment upload failed" message.

Post by cwolf » Thu Sep 25, 2008 12:10 pm

I also forgot to mention that neither "fortress.log" nor "sgvault.log" have any info in them.

shannon

Re: Debugging "Attachment upload failed" message.

Post by shannon » Thu Sep 25, 2008 1:04 pm

try setting LocalPath to be the full path (including filename).

cwolf
Posts: 3
Joined: Thu Sep 25, 2008 11:49 am

Re: Debugging "Attachment upload failed" message.

Post by cwolf » Thu Sep 25, 2008 1:07 pm

That was it, thanks!

What is the "FileName" member for in that case?

shannon

Re: Debugging "Attachment upload failed" message.

Post by shannon » Thu Sep 25, 2008 1:11 pm

I'm not sure, could be just for convenience on the other end (most of my knowledge of that portion of our code lies in consumption). I think both the path and the filename are required, though, so I'd say continue to set both, even if it seems redundant.

Post Reply