New files upload experience improved;

main
Inga 🏳‍🌈 15 years ago
parent a08f4af513
commit face9828ee
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 7
      IISMainHandler/handlers/request/UploadHandler.cs
  4. 12
      templates/Full/result/Upload.xslt

@ -24,7 +24,12 @@ namespace FLocal.IISHandler.handlers.request {
HttpPostedFile file = context.httprequest.Files["file"]; HttpPostedFile file = context.httprequest.Files["file"];
if(file == null) throw new FLocalException("file not uploaded"); if(file == null) throw new FLocalException("file not uploaded");
if(file.ContentLength != file.InputStream.Length) throw new FLocalException("file is not uploaded completely"); if(file.ContentLength != file.InputStream.Length) throw new FLocalException("file is not uploaded completely");
Upload upload = UploadManager.UploadFile(file.InputStream, System.IO.Path.GetFileName(file.FileName), DateTime.Now, context.session.account.user, null); Upload upload;
try {
upload = UploadManager.UploadFile(file.InputStream, System.IO.Path.GetFileName(file.FileName), DateTime.Now, context.session.account.user, null);
} catch(UploadManager.AlreadyUploadedException e) {
upload = Upload.LoadById(e.uploadId);
}
return new XElement[] { return new XElement[] {
new XElement("uploadedId", upload.id) new XElement("uploadedId", upload.id)
}; };

@ -15,13 +15,17 @@
<td class="lighttable"> <td class="lighttable">
<xsl:text>Ôàéë óñïåøíî çàãðóæåí.</xsl:text> <xsl:text>Ôàéë óñïåøíî çàãðóæåí.</xsl:text>
<br/> <br/>
<xsl:text>Теперь вы можете вставлять ссылки на него с помощью тэга [uploadLink=</xsl:text> <xsl:text>Теперь вы можете вставлять ссылки на него с помощью тэга [uploadLink]</xsl:text>
<xsl:value-of select="uploadedId"/> <xsl:value-of select="uploadedId"/>
<xsl:text>]</xsl:text> <xsl:text>[/uploadLink]</xsl:text>
<br/> <br/>
<xsl:text>Для вставки картинки воспользуйтесь тэгом [uploadImage=</xsl:text> <xsl:text>Для вставки картинки воспользуйтесь тэгом [uploadImage]</xsl:text>
<xsl:value-of select="uploadedId"/> <xsl:value-of select="uploadedId"/>
<xsl:text>]</xsl:text> <xsl:text>[/uploadImage]</xsl:text>
<br/>
<img>
<xsl:attribute name="src">/Upload/Item/<xsl:value-of select="uploadedId"/>/</xsl:attribute>
</img>
</td> </td>
</tr> </tr>
</table> </table>

Loading…
Cancel
Save