add: if (currently_selected_file->filetype != FIDIR) { MessageBox("Only uploads to directories are currently supported.\nTry renaming your file and uploading it to a directory on the camcorder\nto overwrite another file on the camcorder."); return FALSE; }
context: gboolean upload_file( GtkWidget *widget,			GdkEvent *event,			gpointer data) {  GtkWidget *file_selection_box = NULL;  //  threesome ts;  GError* error;  //  GtkWidget* file_selection_box = NULL;    if(CheckCameraOpen()==FALSE)    return FALSE;  //  using_dialog_mutex = TRUE;  GtkWidget *file_selection_dialog = NULL;  char* save_filename;  //  GtkWidget* file_selection_box = NULL;    // fill in name of file for easy clicking  GtkTreeModel* model;  GtkTreeIter iter;  GtkTreeSelection* selection;  char* temp_save_filename;  //  gpointer data;  file_info* currently_selected_file;  //char tempfilename[STRINGSIZE];  char delimiter;  char saveto[STRINGSIZE];  threesome* ts = NULL;#ifdef _WIN32  delimiter = '\\';#else  delimiter = '/';#endif  if(CheckCameraOpen()==FALSE)    return FALSE;  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_directory_tree));  if (gtk_tree_selection_get_selected(selection, &model, &iter)) {    //    gchar* filename = NULL;    gtk_tree_model_get(model, &iter, COL_POINTER, &currently_selected_file, -1);    if (currently_selected_file == NULL) {//not too likely      return FALSE;    }  } else {    return FALSE; //nothing selected for download  }  file_selection_dialog =    gtk_file_chooser_dialog_new("Please select a file to upload",				main_window, //meaingless except if program killed				GTK_FILE_CHOOSER_ACTION_SAVE,				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,				GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,				NULL);  //  gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(file_selection_dialog),currently_selected_file->filename );  if (gtk_dialog_run(GTK_DIALOG(file_selection_dialog)) == GTK_RESPONSE_ACCEPT) {    save_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_selection_dialog));    strncpy(saveto, save_filename, STRINGSIZE); //make things easier later on  } else { //user cancelled    gtk_widget_destroy(file_selection_dialog);    return FALSE;  }    gtk_widget_destroy(file_selection_dialog); //does save_filename now point to garbage?    if(currently_selected_file->filetype==FIPART ||     currently_selected_file->filetype==FIROOT) {    MessageBox("Sorry, uploading partitions is not supported");    return FALSE;  }    if(ChangePartition(currently_selected_file->partition)==FALSE) {    Log("ChangePartition(p->partition) failed.");    return FALSE;  }  if(ChangeDirectory(currently_selected_file->dirpath)== FALSE) {    Log("ChangeDirectory(p->dirpath) failed.");    return FALSE;  }    //if uploading to directory, make it use a filename you're saving to instead  if (currently_selected_file->filetype == FIDIR) {    temp_save_filename = saveto;    while (*temp_save_filename++); //go to end    while (--temp_save_filename != saveto) //back up to delimiter point      if (*temp_save_filename == delimiter)	break;    ++temp_save_filename;    if (strlen(temp_save_filename) > 12) {      Log("Please rename this file to an 8.3 filename (ABCDEFGH.IJK for instance)");      return FALSE;    }  } else {    temp_save_filename = currently_selected_file->filename;  }  ts = malloc(sizeof(threesome));  if (ts == NULL) return FALSE;  ts->a = malloc(sizeof(char) * (strlen(saveto) + 1));  if (ts->a == NULL) { //extraordinarily rare...    free(ts);    return FALSE;  }  //temp_save_filename overlaps saveto, but this shouldn't cause trouble  //  ts->b = temp_save_filename; //char*  strcpy(ts->a, saveto); //char*  if (currently_selected_file->filetype == FIDIR) {    ts->b = (temp_save_filename - saveto) + ts->a;  } else {    ts->b = currently_selected_file->filename + strlen(currently_selected_file->dirpath);  }  //  ts->c = &(currently_selected_file->filesize); //int  EnableControls(FALSE);  if (!g_thread_create(upload_file_start_thread, ts, FALSE, &error)) {    Log(error->message);    EnableControls(TRUE);    return FALSE;  }    return TRUE;  }