@greater(dayOfWeek(utcnow()), 0)
@less(dayofweek(utcnow()), 6)
foreach (StorageFile file in files)
{
if (file.Name.StartsWith(LockscreenManager.OriginalFilenamePrefix, StringComparison.OrdinalIgnoreCase))
{
await file.DeleteAsync();
}
}
<Image source="Path/To/Local/File" />
public class ImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
string path = value as string;
if (String.IsNullOrEmpty(path) == false)
{
var storageFile = StorageFile.GetFileFromPathAsync(path).AsTask().Result;
var imageStream = storageFile.OpenStreamForReadAsync().Result;
BitmapImage imgSource = new BitmapImage();
imgSource.SetSource(imageStream.AsRandomAccessStream());
return imgSource;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
using (IsolatedStorageFileStream stream = storage.CreateFile(@"shared/transfers/" + tb_Filename.Text))
{
StringBuilder content = new StringBuilder();
content.AppendLine(String.Format("-----------------------------{0}", boundary));
content.AppendLine(String.Format("Content-Disposition: form-data; name=\"file\"; filename=\"{0}\"", tb_Filename.Text));
content.AppendLine(String.Format("Content-Type: image/jpeg"));
content.AppendLine();
byte[] contentAsBytes = Encoding.UTF8.GetBytes(content.ToString());
stream.Write(contentAsBytes, 0, contentAsBytes.Length);
content.Clear();
_selectedStream.Position = 0;
byte[] buffer = new byte[16 * 1024];
int read;
while ((read = _selectedStream.Read(buffer, 0, buffer.Length)) > 0)
{
stream.Write(buffer, 0, read);
}
content.AppendLine();
content.AppendLine(String.Format("-----------------------------{0}--", boundary));
contentAsBytes = Encoding.UTF8.GetBytes(content.ToString());
stream.Write(contentAsBytes, 0, contentAsBytes.Length);
}
BackgroundTransferRequest request = new BackgroundTransferRequest(new Uri(Uri.EscapeUriString(Page_Upload.UploadDestination), UriKind.Absolute));
request.UploadLocation = new Uri(@"shared/transfers/" + tb_Filename.Text, UriKind.RelativeOrAbsolute);
request.Method = "POST";
request.Tag = tb_Filename.Text;
request.TransferPreferences = TransferPreferences.AllowCellularAndBattery;
request.Headers.Add(new KeyValuePair("Content-Type", String.Format("multipart/form-data; boundary=---------------------------{0}", boundary)));
BackgroundTransferService.Add(request);
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else {
move_uploaded_file($_FILES["file"]["tmp_name"],
"./" . $_FILES["file"]["name"]);
echo "Successful";
}
?>
<form action="upload_file.php" method="POST" enctype="multipart/form-data">
File: <input type="file" name="file" />
<input type="submit" value="Submit" />
</form>
David Kendall | Blog hosted by Blogger
Social media icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY